| Conditions | 1 |
| Paths | 1 |
| Total Lines | 59 |
| 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 |
||
| 7 | public function __invoke() |
||
| 8 | { |
||
| 9 | return [ |
||
| 10 | 'templates' => [ |
||
| 11 | 'map' => [ |
||
| 12 | 'layout/web' => 'templates/layout/web.phtml', |
||
| 13 | 'article/pagination' => 'templates/partial/pagination.phtml', |
||
| 14 | ], |
||
| 15 | 'paths' => [ |
||
| 16 | 'templates' => ['templates'], |
||
| 17 | 'web' => ['templates/web'], |
||
| 18 | ], |
||
| 19 | ], |
||
| 20 | |||
| 21 | 'dependencies' => [ |
||
| 22 | 'factories' => [ |
||
| 23 | Action\HomeAction::class => Factory\Action\HomeActionFactory::class, |
||
| 24 | Action\PageAction::class => Factory\Action\PageActionFactory::class, |
||
| 25 | Action\PostsAction::class => Factory\Action\PostsActionFactory::class, |
||
| 26 | Action\PostAction::class => Factory\Action\PostActionFactory::class, |
||
| 27 | Action\VideosAction::class => Factory\Action\VideosActionFactory::class, |
||
| 28 | Action\VideoAction::class => Factory\Action\VideoActionFactory::class, |
||
| 29 | Action\EventsAction::class => Factory\Action\EventsActionFactory::class, |
||
| 30 | Action\EventAction::class => Factory\Action\EventActionFactory::class, |
||
| 31 | ], |
||
| 32 | ], |
||
| 33 | |||
| 34 | 'routes' => [ |
||
| 35 | [ |
||
| 36 | 'name' => 'home', |
||
| 37 | 'path' => '/', |
||
| 38 | 'middleware' => Action\HomeAction::class, |
||
| 39 | ], |
||
| 40 | [ |
||
| 41 | 'name' => 'page', |
||
| 42 | 'path' => '/{url_slug}', |
||
| 43 | 'middleware' => Action\PageAction::class, |
||
| 44 | ], |
||
| 45 | [ |
||
| 46 | 'name' => 'category', |
||
| 47 | 'path' => '/{category}/', |
||
| 48 | 'middleware' => [ |
||
| 49 | Action\PostsAction::class, |
||
| 50 | Action\VideosAction::class, |
||
| 51 | Action\EventsAction::class, |
||
| 52 | ], |
||
| 53 | ], |
||
| 54 | [ |
||
| 55 | 'name' => 'post', |
||
| 56 | 'path' => '/{segment_1}/{segment_2}', |
||
| 57 | 'middleware' => [ |
||
| 58 | Action\PostAction::class, |
||
| 59 | Action\VideoAction::class, |
||
| 60 | Action\EventAction::class, |
||
| 61 | ], |
||
| 62 | ], |
||
| 63 | ], |
||
| 64 | ]; |
||
| 65 | } |
||
| 66 | } |
||
| 67 |