| Conditions | 3 |
| Paths | 2 |
| Total Lines | 80 |
| Code Lines | 51 |
| 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 |
||
| 31 | public function boot() |
||
| 32 | { |
||
| 33 | $this->registerChiefGuard(); |
||
| 34 | |||
| 35 | $this->app['view']->addNamespace('squanto', __DIR__ . '/../../../resources/views/vendor/squanto'); |
||
| 36 | $this->app['view']->addNamespace('squanto', base_path() . '/resources/views/vendor/thinktomorrow/chief/vendor/squanto'); |
||
| 37 | |||
| 38 | (new MacrosServiceProvider($this->app))->boot(); |
||
| 39 | (new AuthServiceProvider($this->app))->boot(); |
||
| 40 | (new EventServiceProvider($this->app))->boot(); |
||
| 41 | (new ViewServiceProvider($this->app))->boot(); |
||
| 42 | (new SquantoServiceProvider($this->app))->boot(); |
||
| 43 | (new SquantoManagerServiceProvider($this->app))->boot(); |
||
| 44 | (new SettingsServiceProvider($this->app))->boot(); |
||
| 45 | |||
| 46 | (new AssetLibraryServiceProvider($this->app))->boot(); |
||
| 47 | |||
| 48 | // Project defaults |
||
| 49 | (new ChiefProjectServiceProvider($this->app))->boot(); |
||
| 50 | |||
| 51 | $this->loadRoutesFrom(__DIR__ . '/../routes.php'); |
||
| 52 | $this->loadViewsFrom(__DIR__ . '/../../../resources/views', 'chief'); |
||
| 53 | $this->loadMigrationsFrom(__DIR__ . '/../../../database/migrations'); |
||
| 54 | $this->loadTranslationsFrom(__DIR__ . '/../../../resources/lang', 'chief'); |
||
| 55 | |||
| 56 | $this->publishes([ |
||
| 57 | __DIR__ . '/../../../config/chief.php' => config_path('thinktomorrow/chief.php'), |
||
| 58 | __DIR__ . '/../../../config/chief-settings.php' => config_path('thinktomorrow/chief-settings.php'), |
||
| 59 | ], 'chief-config'); |
||
| 60 | |||
| 61 | $this->publishes([ |
||
| 62 | __DIR__ . '/../../../public/chief-assets' => public_path('/chief-assets'), |
||
| 63 | ], 'chief-assets'); |
||
| 64 | |||
| 65 | // Register commands |
||
| 66 | if ($this->app->runningInConsole()) { |
||
| 67 | $this->commands([ |
||
| 68 | // Local development |
||
| 69 | 'command.chief:refresh', |
||
| 70 | 'command.chief:seed', |
||
| 71 | |||
| 72 | // Project setup tools |
||
| 73 | 'command.chief:permission', |
||
| 74 | 'command.chief:role', |
||
| 75 | 'command.chief:admin', |
||
| 76 | 'command.chief:developer', |
||
| 77 | 'command.chief:page', |
||
| 78 | ]); |
||
| 79 | |||
| 80 | // Bind our commands to the container |
||
| 81 | $this->app->bind('command.chief:refresh', RefreshDatabase::class); |
||
| 82 | $this->app->bind('command.chief:seed', Seed::class); |
||
| 83 | $this->app->bind('command.chief:permission', GeneratePermissionCommand::class); |
||
| 84 | $this->app->bind('command.chief:role', GenerateRoleCommand::class); |
||
| 85 | $this->app->bind('command.chief:admin', CreateAdmin::class); |
||
| 86 | $this->app->bind('command.chief:developer', CreateDeveloper::class); |
||
| 87 | $this->app->bind('command.chief:page', function ($app) { |
||
| 88 | return new GeneratePage($app['files'], [ |
||
| 89 | 'base_path' => base_path() |
||
| 90 | ]); |
||
| 91 | }); |
||
| 92 | } |
||
| 93 | |||
| 94 | Blade::component('chief::back._layouts._partials.header', 'chiefheader'); |
||
| 95 | Blade::component('chief::back._elements.formgroup', 'chiefformgroup'); |
||
| 96 | |||
| 97 | // Custom validator for requiring on translations only the fallback locale |
||
| 98 | // this is called in the validation as required-fallback-locale |
||
| 99 | Validator::extendImplicit('requiredFallbackLocale', function ($attribute, $value, $parameters, $validator) { |
||
| 100 | $fallbackLocale = config('app.fallback_locale'); |
||
| 101 | |||
| 102 | if (false !== strpos($attribute, 'trans.' . $fallbackLocale . '.')) { |
||
| 103 | return !!trim($value); |
||
| 104 | } |
||
| 105 | |||
| 106 | return true; |
||
| 107 | }, 'Voor :attribute is minstens de default taal verplicht in te vullen, aub.'); |
||
| 108 | |||
| 109 | $this->autoloadMiddleware(); |
||
| 110 | $this->autoloadRoute(); |
||
| 111 | } |
||
| 207 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.