| Conditions | 3 |
| Paths | 1 |
| Total Lines | 167 |
| Code Lines | 111 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 79 | protected function initializeMappings() |
||
| 80 | { |
||
| 81 | $this->mappings['columnDimension']['__multi'] = true; |
||
| 82 | $this->mappings['columnDimension']['__object'] = function ($key = 'default') { |
||
| 83 | return $key === 'default' ? $this->object->getDefaultColumnDimension() : $this->object->getColumnDimension($key); |
||
| 84 | }; |
||
| 85 | $this->mappings['columnDimension']['autoSize'] = function ($key, $value) { |
||
| 86 | $this->mappings['columnDimension']['__object']($key)->setAutoSize($value); |
||
| 87 | }; |
||
| 88 | $this->mappings['columnDimension']['collapsed'] = function ($key, $value) { |
||
| 89 | $this->mappings['columnDimension']['__object']($key)->setCollapsed($value); |
||
| 90 | }; |
||
| 91 | $this->mappings['columnDimension']['columnIndex'] = function ($key, $value) { |
||
| 92 | $this->mappings['columnDimension']['__object']($key)->setColumnIndex($value); |
||
| 93 | }; |
||
| 94 | $this->mappings['columnDimension']['outlineLevel'] = function ($key, $value) { |
||
| 95 | $this->mappings['columnDimension']['__object']($key)->setOutlineLevel($value); |
||
| 96 | }; |
||
| 97 | $this->mappings['columnDimension']['visible'] = function ($key, $value) { |
||
| 98 | $this->mappings['columnDimension']['__object']($key)->setVisible($value); |
||
| 99 | }; |
||
| 100 | $this->mappings['columnDimension']['width'] = function ($key, $value) { |
||
| 101 | $this->mappings['columnDimension']['__object']($key)->setWidth($value); |
||
| 102 | }; |
||
| 103 | $this->mappings['columnDimension']['xfIndex'] = function ($key, $value) { |
||
| 104 | $this->mappings['columnDimension']['__object']($key)->setXfIndex($value); |
||
| 105 | }; |
||
| 106 | $this->mappings['pageMargins']['top'] = function ($value) { |
||
| 107 | $this->object->getPageMargins()->setTop($value); |
||
| 108 | }; |
||
| 109 | $this->mappings['pageMargins']['bottom'] = function ($value) { |
||
| 110 | $this->object->getPageMargins()->setBottom($value); |
||
| 111 | }; |
||
| 112 | $this->mappings['pageMargins']['left'] = function ($value) { |
||
| 113 | $this->object->getPageMargins()->setLeft($value); |
||
| 114 | }; |
||
| 115 | $this->mappings['pageMargins']['right'] = function ($value) { |
||
| 116 | $this->object->getPageMargins()->setRight($value); |
||
| 117 | }; |
||
| 118 | $this->mappings['pageMargins']['header'] = function ($value) { |
||
| 119 | $this->object->getPageMargins()->setHeader($value); |
||
| 120 | }; |
||
| 121 | $this->mappings['pageMargins']['footer'] = function ($value) { |
||
| 122 | $this->object->getPageMargins()->setFooter($value); |
||
| 123 | }; |
||
| 124 | $this->mappings['pageSetup']['fitToHeight'] = function ($value) { |
||
| 125 | $this->object->getPageSetup()->setFitToHeight($value); |
||
| 126 | }; |
||
| 127 | $this->mappings['pageSetup']['fitToPage'] = function ($value) { |
||
| 128 | $this->object->getPageSetup()->setFitToPage($value); |
||
| 129 | }; |
||
| 130 | $this->mappings['pageSetup']['fitToWidth'] = function ($value) { |
||
| 131 | $this->object->getPageSetup()->setFitToWidth($value); |
||
| 132 | }; |
||
| 133 | $this->mappings['pageSetup']['horizontalCentered'] = function ($value) { |
||
| 134 | $this->object->getPageSetup()->setHorizontalCentered($value); |
||
| 135 | }; |
||
| 136 | $this->mappings['pageSetup']['orientation'] = function ($value) { |
||
| 137 | $this->object->getPageSetup()->setOrientation($value); |
||
| 138 | }; |
||
| 139 | $this->mappings['pageSetup']['paperSize'] = function ($value) { |
||
| 140 | $this->object->getPageSetup()->setPaperSize($value); |
||
| 141 | }; |
||
| 142 | $this->mappings['pageSetup']['printArea'] = function ($value) { |
||
| 143 | $this->object->getPageSetup()->setPrintArea($value); |
||
| 144 | }; |
||
| 145 | $this->mappings['pageSetup']['scale'] = function ($value) { |
||
| 146 | $this->object->getPageSetup()->setScale($value); |
||
| 147 | }; |
||
| 148 | $this->mappings['pageSetup']['verticalCentered'] = function ($value) { |
||
| 149 | $this->object->getPageSetup()->setVerticalCentered($value); |
||
| 150 | }; |
||
| 151 | $this->mappings['printGridlines'] = function ($value) { |
||
| 152 | $this->object->setPrintGridlines($value); |
||
| 153 | }; |
||
| 154 | $this->mappings['protection']['autoFilter'] = function ($value) { |
||
| 155 | $this->object->getProtection()->setAutoFilter($value); |
||
| 156 | }; |
||
| 157 | $this->mappings['protection']['deleteColumns'] = function ($value) { |
||
| 158 | $this->object->getProtection()->setDeleteColumns($value); |
||
| 159 | }; |
||
| 160 | $this->mappings['protection']['deleteRows'] = function ($value) { |
||
| 161 | $this->object->getProtection()->setDeleteRows($value); |
||
| 162 | }; |
||
| 163 | $this->mappings['protection']['formatCells'] = function ($value) { |
||
| 164 | $this->object->getProtection()->setFormatCells($value); |
||
| 165 | }; |
||
| 166 | $this->mappings['protection']['formatColumns'] = function ($value) { |
||
| 167 | $this->object->getProtection()->setFormatColumns($value); |
||
| 168 | }; |
||
| 169 | $this->mappings['protection']['formatRows'] = function ($value) { |
||
| 170 | $this->object->getProtection()->setFormatRows($value); |
||
| 171 | }; |
||
| 172 | $this->mappings['protection']['insertColumns'] = function ($value) { |
||
| 173 | $this->object->getProtection()->setInsertColumns($value); |
||
| 174 | }; |
||
| 175 | $this->mappings['protection']['insertHyperlinks'] = function ($value) { |
||
| 176 | $this->object->getProtection()->setInsertHyperlinks($value); |
||
| 177 | }; |
||
| 178 | $this->mappings['protection']['insertRows'] = function ($value) { |
||
| 179 | $this->object->getProtection()->setInsertRows($value); |
||
| 180 | }; |
||
| 181 | $this->mappings['protection']['objects'] = function ($value) { |
||
| 182 | $this->object->getProtection()->setObjects($value); |
||
| 183 | }; |
||
| 184 | $this->mappings['protection']['password'] = function ($value) { |
||
| 185 | $this->object->getProtection()->setPassword($value); |
||
| 186 | }; |
||
| 187 | $this->mappings['protection']['pivotTables'] = function ($value) { |
||
| 188 | $this->object->getProtection()->setPivotTables($value); |
||
| 189 | }; |
||
| 190 | $this->mappings['protection']['scenarios'] = function ($value) { |
||
| 191 | $this->object->getProtection()->setScenarios($value); |
||
| 192 | }; |
||
| 193 | $this->mappings['protection']['selectLockedCells'] = function ($value) { |
||
| 194 | $this->object->getProtection()->setSelectLockedCells($value); |
||
| 195 | }; |
||
| 196 | $this->mappings['protection']['selectUnlockedCells'] = function ($value) { |
||
| 197 | $this->object->getProtection()->setSelectUnlockedCells($value); |
||
| 198 | }; |
||
| 199 | $this->mappings['protection']['sheet'] = function ($value) { |
||
| 200 | $this->object->getProtection()->setSheet($value); |
||
| 201 | }; |
||
| 202 | $this->mappings['protection']['sort'] = function ($value) { |
||
| 203 | $this->object->getProtection()->setSort($value); |
||
| 204 | }; |
||
| 205 | $this->mappings['rightToLeft'] = function ($value) { |
||
| 206 | $this->object->setRightToLeft($value); |
||
| 207 | }; |
||
| 208 | $this->mappings['rowDimension']['__multi'] = true; |
||
| 209 | $this->mappings['rowDimension']['__object'] = function ($key) { |
||
| 210 | return $key === 'default' ? $this->object->getDefaultRowDimension() : $this->object->getRowDimension($key); |
||
| 211 | }; |
||
| 212 | $this->mappings['rowDimension']['collapsed'] = function ($key, $value) { |
||
| 213 | $this->mappings['rowDimension']['__object']($key)->setCollapsed($value); |
||
| 214 | }; |
||
| 215 | $this->mappings['rowDimension']['outlineLevel'] = function ($key, $value) { |
||
| 216 | $this->mappings['rowDimension']['__object']($key)->setOutlineLevel($value); |
||
| 217 | }; |
||
| 218 | $this->mappings['rowDimension']['rowHeight'] = function ($key, $value) { |
||
| 219 | $this->mappings['rowDimension']['__object']($key)->setRowHeight($value); |
||
| 220 | }; |
||
| 221 | $this->mappings['rowDimension']['rowIndex'] = function ($key, $value) { |
||
| 222 | $this->mappings['rowDimension']['__object']($key)->setRowIndex($value); |
||
| 223 | }; |
||
| 224 | $this->mappings['rowDimension']['visible'] = function ($key, $value) { |
||
| 225 | $this->mappings['rowDimension']['__object']($key)->setVisible($value); |
||
| 226 | }; |
||
| 227 | $this->mappings['rowDimension']['xfIndex'] = function ($key, $value) { |
||
| 228 | $this->mappings['rowDimension']['__object']($key)->setXfIndex($value); |
||
| 229 | }; |
||
| 230 | $this->mappings['rowDimension']['zeroHeight'] = function ($key, $value) { |
||
| 231 | $this->mappings['rowDimension']['__object']($key)->setZeroHeight($value); |
||
| 232 | }; |
||
| 233 | $this->mappings['sheetState'] = function ($value) { |
||
| 234 | $this->object->setSheetState($value); |
||
| 235 | }; |
||
| 236 | $this->mappings['showGridlines'] = function ($value) { |
||
| 237 | $this->object->setShowGridlines($value); |
||
| 238 | }; |
||
| 239 | $this->mappings['tabColor'] = function ($value) { |
||
| 240 | $this->object->getTabColor()->setRGB($value); |
||
| 241 | }; |
||
| 242 | $this->mappings['zoomScale'] = function ($value) { |
||
| 243 | $this->object->getSheetView()->setZoomScale($value); |
||
| 244 | }; |
||
| 245 | } |
||
| 246 | |||
| 384 |