| Conditions | 5 |
| Paths | 1 |
| Total Lines | 52 |
| Code Lines | 29 |
| 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 |
||
| 42 | protected function navigation(Menu $navigation) |
||
| 43 | { |
||
| 44 | $navigation->create(Navigable::MENU_SIDEBAR, function (MenuBuilder $sidebar) { |
||
| 45 | // Dashboard |
||
| 46 | $sidebar->route('scaffold.dashboard', trans('administrator::module.dashboard'), [], 1, [ |
||
| 47 | 'id' => 'dashboard', |
||
| 48 | 'icon' => 'fa fa-home', |
||
| 49 | 'active' => str_is(request()->route()->getName(), 'scaffold.dashboard'), |
||
| 50 | ]); |
||
| 51 | |||
| 52 | // Create "resources" group |
||
| 53 | $sidebar->dropdown(trans('administrator::module.groups.resources'), function (MenuItem $sub) { |
||
| 54 | }, 2, ['id' => 'groups', 'icon' => 'fa fa-qrcode']); |
||
| 55 | }); |
||
| 56 | |||
| 57 | $navigation->create(Navigable::MENU_TOOLS, function (MenuBuilder $tools) { |
||
| 58 | if (config('administrator.file_manager.enabled')) { |
||
| 59 | $tools->url( |
||
| 60 | route('scaffold.media'), |
||
| 61 | trans('administrator::buttons.media'), |
||
| 62 | 1, |
||
| 63 | ['icon' => 'fa fa-file-text-o'] |
||
| 64 | ); |
||
| 65 | } |
||
| 66 | |||
| 67 | if (config('administrator.settings.enabled') && class_exists(OptionsManager::class, true)) { |
||
| 68 | $tools->url( |
||
| 69 | route('scaffold.settings.edit'), |
||
| 70 | trans('administrator::module.resources.settings'), |
||
| 71 | 2, |
||
| 72 | ['icon' => 'fa fa-gears'] |
||
| 73 | ); |
||
| 74 | } |
||
| 75 | |||
| 76 | if (config('administrator.translations.enabled')) { |
||
| 77 | $tools->url( |
||
| 78 | route('scaffold.translations.index'), |
||
| 79 | trans('administrator::buttons.translations'), |
||
| 80 | 3, |
||
| 81 | ['icon' => 'fa fa-globe'] |
||
| 82 | ); |
||
| 83 | } |
||
| 84 | |||
| 85 | $tools->url( |
||
| 86 | route('scaffold.logout'), |
||
| 87 | trans('administrator::buttons.logout'), |
||
| 88 | 100, |
||
| 89 | ['icon' => 'fa fa-mail-forward'] |
||
| 90 | ); |
||
| 91 | }); |
||
| 92 | |||
| 93 | return $navigation; |
||
| 94 | } |
||
| 139 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths