| Conditions | 3 |
| Paths | 1 |
| Total Lines | 79 |
| Code Lines | 47 |
| 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 |
||
| 19 | public function boot(): void |
||
| 20 | { |
||
| 21 | $this->app['view']->addNamespace('chief-fragments', __DIR__ . '/../../src/Fragments/resources'); |
||
| 22 | |||
| 23 | View::composer([ |
||
| 24 | 'chief::manager._transitions.modals.archive-modal', |
||
| 25 | ], function ($view) { |
||
| 26 | $viewData = $view->getData(); |
||
| 27 | |||
| 28 | $ignoredModel = (isset($viewData['model'])) |
||
| 29 | ? $viewData['model'] |
||
| 30 | : null; |
||
| 31 | |||
| 32 | $onlineModels = UrlHelper::allOnlineModels(false, $ignoredModel); |
||
| 33 | |||
| 34 | $view->with('targetModels', $onlineModels); |
||
| 35 | }); |
||
| 36 | |||
| 37 | Blade::componentNamespace('Thinktomorrow\\Chief\\App\\View\\Components', 'chief'); |
||
| 38 | |||
| 39 | // Livewire components |
||
| 40 | // Livewire::component('fragments', Fragments::class); |
||
| 41 | // Livewire::component('links', Links::class); |
||
| 42 | // Livewire::component('fields-window', FieldsWindow::class); |
||
| 43 | // Livewire::component('status', Status::class); |
||
| 44 | |||
| 45 | /* Livewire component wrappers */ |
||
| 46 | // Blade::component('chief-fragments::window', 'chief-fragments::window'); |
||
| 47 | // Blade::component('chief::manager.windows.fields.window', 'chief::window.fields'); |
||
| 48 | Blade::component('chief::manager.windows.fields.window', 'chief::window.fields'); |
||
| 49 | Blade::component('chief::manager.windows.status.window', 'chief::window.status'); |
||
| 50 | Blade::component('chief::manager.windows.links.window', 'chief::window.links'); |
||
| 51 | |||
| 52 | /* Chief components */ |
||
| 53 | Blade::component('chief::components.window', 'chief::window'); |
||
| 54 | Blade::component('chief::components.title', 'chief-title'); |
||
| 55 | Blade::component('chief::components.content', 'chief-content'); |
||
| 56 | Blade::component('chief::components.card', 'chief-card'); |
||
| 57 | Blade::component('chief::components.sidebar', 'chief-sidebar'); |
||
| 58 | Blade::component('chief::components.inline-notification', 'chief-inline-notification'); |
||
| 59 | Blade::component('chief::components.icon-label', 'chief-icon-label'); |
||
| 60 | Blade::component('chief::components.icon-button', 'chief-icon-button'); |
||
| 61 | Blade::component('chief::components.hierarchy', 'chief-hierarchy'); |
||
| 62 | |||
| 63 | /* Wireframe components */ |
||
| 64 | Blade::component('chief::wireframes.wireframe', 'wireframe'); |
||
| 65 | Blade::component('chief::wireframes.container', 'wireframe-container'); |
||
| 66 | Blade::component('chief::wireframes.row', 'wireframe-row'); |
||
| 67 | Blade::component('chief::wireframes.column', 'wireframe-column'); |
||
| 68 | Blade::component('chief::wireframes.title', 'wireframe-title'); |
||
| 69 | Blade::component('chief::wireframes.text', 'wireframe-text'); |
||
| 70 | Blade::component('chief::wireframes.image', 'wireframe-image'); |
||
| 71 | Blade::component('chief::wireframes.video', 'wireframe-video'); |
||
| 72 | Blade::component('chief::wireframes.rect', 'wireframe-rect'); |
||
| 73 | |||
| 74 | /* Chief directives */ |
||
| 75 | Blade::directive('fragments', function () { |
||
| 76 | return "<?php echo app(\Thinktomorrow\Chief\Fragments\FragmentsRenderer::class)->render(\$model, get_defined_vars()); ?>"; |
||
| 77 | }); |
||
| 78 | Blade::directive('adminConfig', function ($expression = null) { |
||
| 79 | if ($expression) { |
||
| 80 | $method = "get".ucfirst(str_replace("'", '', $expression)); |
||
| 81 | |||
| 82 | return "<?php echo \$model->adminConfig()->$method(); ?>"; |
||
| 83 | } |
||
| 84 | |||
| 85 | return "<?php echo \$model->adminConfig(); ?>"; |
||
| 86 | }); |
||
| 87 | Blade::directive('adminRoute', function ($expression) { |
||
| 88 | return "<?php echo \$manager->route($expression); ?>"; |
||
| 89 | }); |
||
| 90 | Blade::directive('adminCan', function ($expression) { |
||
| 91 | return "<?php if (\$manager->can($expression)) { ?>"; |
||
| 92 | }); |
||
| 93 | Blade::directive('elseAdminCan', function () { |
||
| 94 | return "<?php } else { ?>"; |
||
| 95 | }); |
||
| 96 | Blade::directive('endAdminCan', function () { |
||
| 97 | return "<?php } ?>"; |
||
| 98 | }); |
||
| 106 |
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