| Conditions | 3 |
| Paths | 1 |
| Total Lines | 78 |
| 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 |
||
| 208 | protected function configureMappings(): array |
||
| 209 | { |
||
| 210 | return [ |
||
| 211 | 'autoFilter' => function ($value) { $this->object->setAutoFilter($value); }, |
||
| 212 | 'columnDimension' => [ |
||
| 213 | '__multi' => function ($index = 'default'): ColumnDimension { |
||
| 214 | return $index === 'default' ? |
||
| 215 | $this->object->getDefaultColumnDimension() : |
||
| 216 | $this->object->getColumnDimension($index); |
||
| 217 | }, |
||
| 218 | 'autoSize' => function ($value, ColumnDimension $object) { $object->setAutoSize($value); }, |
||
| 219 | 'collapsed' => function ($value, ColumnDimension $object) { $object->setCollapsed($value); }, |
||
| 220 | 'columnIndex' => function ($value, ColumnDimension $object) { $object->setColumnIndex($value); }, |
||
| 221 | 'outlineLevel' => function ($value, ColumnDimension $object) { $object->setOutlineLevel($value); }, |
||
| 222 | 'visible' => function ($value, ColumnDimension $object) { $object->setVisible($value); }, |
||
| 223 | 'width' => function ($value, ColumnDimension $object) { $object->setWidth($value); }, |
||
| 224 | 'xfIndex' => function ($value, ColumnDimension $object) { $object->setXfIndex($value); }, |
||
| 225 | ], |
||
| 226 | 'pageMargins' => [ |
||
| 227 | 'top' => function ($value) { $this->object->getPageMargins()->setTop($value); }, |
||
| 228 | 'bottom' => function ($value) { $this->object->getPageMargins()->setBottom($value); }, |
||
| 229 | 'left' => function ($value) { $this->object->getPageMargins()->setLeft($value); }, |
||
| 230 | 'right' => function ($value) { $this->object->getPageMargins()->setRight($value); }, |
||
| 231 | 'header' => function ($value) { $this->object->getPageMargins()->setHeader($value); }, |
||
| 232 | 'footer' => function ($value) { $this->object->getPageMargins()->setFooter($value); }, |
||
| 233 | ], |
||
| 234 | 'pageSetup' => [ |
||
| 235 | 'fitToHeight' => function ($value) { $this->object->getPageSetup()->setFitToHeight($value); }, |
||
| 236 | 'fitToPage' => function ($value) { $this->object->getPageSetup()->setFitToPage($value); }, |
||
| 237 | 'fitToWidth' => function ($value) { $this->object->getPageSetup()->setFitToWidth($value); }, |
||
| 238 | 'horizontalCentered' => function ($value) { $this->object->getPageSetup()->setHorizontalCentered($value); }, |
||
| 239 | 'orientation' => function ($value) { $this->object->getPageSetup()->setOrientation($value); }, |
||
| 240 | 'paperSize' => function ($value) { $this->object->getPageSetup()->setPaperSize($value); }, |
||
| 241 | 'printArea' => function ($value) { $this->object->getPageSetup()->setPrintArea($value); }, |
||
| 242 | 'scale' => function ($value) { $this->object->getPageSetup()->setScale($value); }, |
||
| 243 | 'verticalCentered' => function ($value) { $this->object->getPageSetup()->setVerticalCentered($value); }, |
||
| 244 | ], |
||
| 245 | 'printGridlines' => function ($value) { $this->object->setPrintGridlines($value); }, |
||
| 246 | 'protection' => [ |
||
| 247 | 'autoFilter' => function ($value) { $this->object->getProtection()->setAutoFilter($value); }, |
||
| 248 | 'deleteColumns' => function ($value) { $this->object->getProtection()->setDeleteColumns($value); }, |
||
| 249 | 'deleteRows' => function ($value) { $this->object->getProtection()->setDeleteRows($value); }, |
||
| 250 | 'formatCells' => function ($value) { $this->object->getProtection()->setFormatCells($value); }, |
||
| 251 | 'formatColumns' => function ($value) { $this->object->getProtection()->setFormatColumns($value); }, |
||
| 252 | 'formatRows' => function ($value) { $this->object->getProtection()->setFormatRows($value); }, |
||
| 253 | 'insertColumns' => function ($value) { $this->object->getProtection()->setInsertColumns($value); }, |
||
| 254 | 'insertHyperlinks' => function ($value) { $this->object->getProtection()->setInsertHyperlinks($value); }, |
||
| 255 | 'insertRows' => function ($value) { $this->object->getProtection()->setInsertRows($value); }, |
||
| 256 | 'objects' => function ($value) { $this->object->getProtection()->setObjects($value); }, |
||
| 257 | 'password' => function ($value) { $this->object->getProtection()->setPassword($value); }, |
||
| 258 | 'pivotTables' => function ($value) { $this->object->getProtection()->setPivotTables($value); }, |
||
| 259 | 'scenarios' => function ($value) { $this->object->getProtection()->setScenarios($value); }, |
||
| 260 | 'selectLockedCells' => function ($value) { $this->object->getProtection()->setSelectLockedCells($value); }, |
||
| 261 | 'selectUnlockedCells' => function ($value) { $this->object->getProtection()->setSelectUnlockedCells($value); }, |
||
| 262 | 'sheet' => function ($value) { $this->object->getProtection()->setSheet($value); }, |
||
| 263 | 'sort' => function ($value) { $this->object->getProtection()->setSort($value); }, |
||
| 264 | ], |
||
| 265 | 'rightToLeft' => function ($value) { $this->object->setRightToLeft($value); }, |
||
| 266 | 'rowDimension' => [ |
||
| 267 | '__multi' => function ($index = 'default'): RowDimension { |
||
| 268 | return $index === 'default' ? |
||
| 269 | $this->object->getDefaultRowDimension() : |
||
| 270 | $this->object->getRowDimension($index); |
||
| 271 | }, |
||
| 272 | 'collapsed' => function ($value, RowDimension $object) { $object->setCollapsed($value); }, |
||
| 273 | 'outlineLevel' => function ($value, RowDimension $object) { $object->setOutlineLevel($value); }, |
||
| 274 | 'rowHeight' => function ($value, RowDimension $object) { $object->setRowHeight($value); }, |
||
| 275 | 'rowIndex' => function ($value, RowDimension $object) { $object->setRowIndex($value); }, |
||
| 276 | 'visible' => function ($value, RowDimension $object) { $object->setVisible($value); }, |
||
| 277 | 'xfIndex' => function ($value, RowDimension $object) { $object->setXfIndex($value); }, |
||
| 278 | 'zeroHeight' => function ($value, RowDimension $object) { $object->setZeroHeight($value); }, |
||
| 279 | ], |
||
| 280 | 'sheetState' => function ($value) { $this->object->setSheetState($value); }, |
||
| 281 | 'showGridlines' => function ($value) { $this->object->setShowGridlines($value); }, |
||
| 282 | 'tabColor' => function ($value) { $this->object->getTabColor()->setRGB($value); }, |
||
| 283 | 'zoomScale' => function ($value) { $this->object->getSheetView()->setZoomScale($value); }, |
||
| 284 | ]; |
||
| 285 | } |
||
| 286 | } |
||
| 287 |