| Conditions | 1 |
| Paths | 1 |
| Total Lines | 67 |
| Code Lines | 60 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| 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 |
||
| 52 | public function getItems() |
||
| 53 | { |
||
| 54 | [ |
||
| 55 | 'database' => [ |
||
| 56 | 'title' => 'Database', |
||
| 57 | 'slug' => 'database', |
||
| 58 | 'url' => '/database', |
||
| 59 | 'parent' => null, |
||
| 60 | 'route' => null, |
||
| 61 | 'params' => null, |
||
| 62 | 'controller' => null, |
||
| 63 | 'middleware' => null, |
||
| 64 | 'target' => '_self', |
||
| 65 | 'icon' => '<i class="fas fa-database"></i>', |
||
| 66 | 'custom_class' => null, |
||
| 67 | ], |
||
| 68 | 'table' => [ |
||
| 69 | 'title' => 'Table', |
||
| 70 | 'slug' => 'table', |
||
| 71 | 'url' => '/database', |
||
| 72 | 'parent' => 'database', |
||
| 73 | 'route' => 'database', |
||
| 74 | 'params' => null, |
||
| 75 | 'controller' => null, |
||
| 76 | 'middleware' => null, |
||
| 77 | 'target' => '_self', |
||
| 78 | 'icon' => '<i class="fas fa-table"></i>', |
||
| 79 | 'custom_class' => null, |
||
| 80 | ], |
||
| 81 | 'crud' => [ |
||
| 82 | 'title' => 'Crud', |
||
| 83 | 'slug' => 'crud', |
||
| 84 | 'url' => '/database/crud', |
||
| 85 | 'parent' => 'database', |
||
| 86 | 'route' => 'crud', |
||
| 87 | 'params' => null, |
||
| 88 | 'controller' => null, |
||
| 89 | 'middleware' => null, |
||
| 90 | 'target' => '_self', |
||
| 91 | 'icon' => '<i class="fas fa-database"></i>', |
||
| 92 | 'custom_class' => null, |
||
| 93 | ], |
||
| 94 | 'permission' => [ |
||
| 95 | 'title' => 'Permission', |
||
| 96 | 'slug' => 'permission', |
||
| 97 | 'url' => '/permission', |
||
| 98 | 'parent' => 'database', |
||
| 99 | 'route' => 'permission', |
||
| 100 | 'params' => null, |
||
| 101 | 'controller' => null, |
||
| 102 | 'middleware' => null, |
||
| 103 | 'target' => '_self', |
||
| 104 | 'icon' => '<i class="fas fa-user-lock"></i>', |
||
| 105 | 'custom_class' => null, |
||
| 106 | ], |
||
| 107 | 'backup' => [ |
||
| 108 | 'title' => 'Backup', |
||
| 109 | 'slug' => 'backup', |
||
| 110 | 'url' => '/database', |
||
| 111 | 'parent' => 'database', |
||
| 112 | 'route' => 'backup', |
||
| 113 | 'params' => null, |
||
| 114 | 'controller' => null, |
||
| 115 | 'middleware' => null, |
||
| 116 | 'target' => '_self', |
||
| 117 | 'icon' => '<i class="fas fa-sync"></i>', |
||
| 118 | 'custom_class' => null, |
||
| 119 | ], |
||
| 123 |