| Conditions | 3 |
| Paths | 4 |
| Total Lines | 83 |
| Code Lines | 53 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| 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 |
||
| 39 | public function boot(): void |
||
| 40 | { |
||
| 41 | $this->registerChiefGuard(); |
||
| 42 | $this->registerSquanto(); |
||
| 43 | |||
| 44 | (new MacrosServiceProvider($this->app))->boot(); |
||
| 45 | (new AuthServiceProvider($this->app))->boot(); |
||
| 46 | (new EventServiceProvider($this->app))->boot(); |
||
| 47 | (new ViewServiceProvider($this->app))->boot(); |
||
| 48 | (new FormsServiceProvider($this->app))->boot(); |
||
| 49 | (new SquantoServiceProvider($this->app))->boot(); |
||
| 50 | (new SquantoManagerServiceProvider($this->app))->boot(); |
||
| 51 | (new SettingsServiceProvider($this->app))->boot(); |
||
| 52 | |||
| 53 | // Packages |
||
| 54 | (new AssetLibraryServiceProvider($this->app))->boot(); |
||
| 55 | (new SitemapServiceProvider($this->app))->boot(); |
||
| 56 | (new LivewireServiceProvider($this->app))->boot(); |
||
| 57 | |||
| 58 | // Project defaults |
||
| 59 | (new ChiefRoutesServiceProvider($this->app))->boot(); |
||
| 60 | |||
| 61 | // Addons |
||
| 62 | foreach (config('chief.addons', []) as $addonServiceProvider) { |
||
| 63 | (new $addonServiceProvider($this->app))->boot(); |
||
| 64 | } |
||
| 65 | |||
| 66 | $this->loadViewsFrom(__DIR__ . '/../../resources/views', 'chief'); |
||
| 67 | $this->loadMigrationsFrom(__DIR__ . '/../../database/migrations'); |
||
| 68 | $this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'chief'); |
||
| 69 | |||
| 70 | $this->publishes([ |
||
| 71 | __DIR__ . '/../../config/chief.php' => config_path('chief.php'), |
||
| 72 | __DIR__ . '/../../config/chief-settings.php' => config_path('chief-settings.php'), |
||
| 73 | ], 'chief-config'); |
||
| 74 | |||
| 75 | $this->publishes([ |
||
| 76 | __DIR__ . '/../../public/chief-assets' => public_path('/chief-assets'), |
||
| 77 | ], 'chief-assets'); |
||
| 78 | |||
| 79 | // Commands for both cli and web scripts |
||
| 80 | $this->commands([ |
||
| 81 | // Sitemap generation |
||
| 82 | 'command.chief:sitemap', |
||
| 83 | ]); |
||
| 84 | |||
| 85 | $this->app->bind('command.chief:sitemap', GenerateSitemap::class); |
||
| 86 | |||
| 87 | // Commands for cli only |
||
| 88 | if ($this->app->runningInConsole()) { |
||
| 89 | $this->commands([ |
||
| 90 | // Local development |
||
| 91 | 'command.chief:refresh', |
||
| 92 | 'command.chief:seed', |
||
| 93 | |||
| 94 | // Project setup tools |
||
| 95 | 'command.chief:permission', |
||
| 96 | 'command.chief:role', |
||
| 97 | |||
| 98 | 'command.chief:admin', |
||
| 99 | 'command.chief:developer', |
||
| 100 | 'command.chief:page', |
||
| 101 | 'command.chief:page-migration', |
||
| 102 | 'command.chief:fragment', |
||
| 103 | 'command.chief:view', |
||
| 104 | ]); |
||
| 105 | |||
| 106 | // Bind our commands to the container |
||
| 107 | $this->app->bind('command.chief:refresh', RefreshDatabase::class); |
||
| 108 | $this->app->bind('command.chief:seed', Seed::class); |
||
| 109 | $this->app->bind('command.chief:permission', GeneratePermissionCommand::class); |
||
| 110 | $this->app->bind('command.chief:role', GenerateRoleCommand::class); |
||
| 111 | |||
| 112 | $this->app->bind('command.chief:page', CreatePageCommand::class); |
||
| 113 | $this->app->bind('command.chief:page-migration', CreatePageMigrationCommand::class); |
||
| 114 | $this->app->bind('command.chief:view', CreateViewCommand::class); |
||
| 115 | $this->app->bind('command.chief:fragment', CreateFragmentCommand::class); |
||
| 116 | $this->app->bind('command.chief:admin', CreateAdmin::class); |
||
| 117 | $this->app->bind('command.chief:developer', CreateDeveloper::class); |
||
| 118 | } |
||
| 119 | |||
| 120 | Relation::morphMap([ |
||
| 121 | 'fragmentmodel' => FragmentModel::class, |
||
| 122 | ]); |
||
| 239 |