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