| Conditions | 4 |
| Paths | 4 |
| Total Lines | 54 |
| Code Lines | 19 |
| 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 |
||
| 13 | public function boot() |
||
| 14 | { |
||
| 15 | /* |
||
| 16 | * Optional methods to load your package assets |
||
| 17 | */ |
||
| 18 | // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'laravel-events-calendar'); |
||
| 19 | // $this->loadViewsFrom(__DIR__.'/../resources/views', 'laravel-events-calendar'); |
||
| 20 | // $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
||
| 21 | // $this->loadRoutesFrom(__DIR__.'/routes.php'); |
||
| 22 | |||
| 23 | if ($this->app->runningInConsole()) { |
||
| 24 | $this->publishes([ |
||
| 25 | __DIR__.'/../config/config.php' => config_path('laravel-events-calendar.php'), |
||
| 26 | ], 'config'); |
||
| 27 | |||
| 28 | // Publishing the views. |
||
| 29 | /*$this->publishes([ |
||
| 30 | __DIR__.'/../resources/views' => resource_path('views/vendor/laravel-events-calendar'), |
||
| 31 | ], 'views');*/ |
||
| 32 | |||
| 33 | // Publishing assets. |
||
| 34 | /*$this->publishes([ |
||
| 35 | __DIR__.'/../resources/assets' => public_path('vendor/laravel-events-calendar'), |
||
| 36 | ], 'assets');*/ |
||
| 37 | |||
| 38 | // Publishing the translation files. |
||
| 39 | /*$this->publishes([ |
||
| 40 | __DIR__.'/../resources/lang' => resource_path('lang/vendor/laravel-events-calendar'), |
||
| 41 | ], 'lang');*/ |
||
| 42 | |||
| 43 | // Registering package commands. |
||
| 44 | // $this->commands([]); |
||
| 45 | |||
| 46 | /* - Migrations - |
||
| 47 | create a migration instance for each .php.stub file eg. |
||
| 48 | create_continents_table.php.stub ---> 2019_04_28_190434761474_create_continents_table.php |
||
| 49 | */ |
||
| 50 | $migrations = [ |
||
| 51 | 'CreateQuotesTable' => 'create_continents_table', |
||
| 52 | 'CreateCountriesTable' => 'create_countries_table', |
||
| 53 | 'CreateEventHasOrganizersTable' => 'create_event_has_organizers_table', |
||
| 54 | 'CreateEventHasTeachersTable' => 'create_event_has_teachers_table', |
||
| 55 | 'CreateEventsTable' => 'create_events_table', |
||
| 56 | 'CreateOrganizersTable' => 'create_organizers_table', |
||
| 57 | 'CreateEventCategoriesTable' => 'event_categories_table', |
||
| 58 | 'CreateEventRepetitionsTable' => 'event_repetitions_table', |
||
| 59 | 'CreateEventVenuesTable' => 'event_venues', |
||
| 60 | ]; |
||
| 61 | |||
| 62 | foreach ($migrations as $migrationFunctionName => $migrationFileName) { |
||
| 63 | if (! class_exists($migrationFunctionName)) { |
||
| 64 | $this->publishes([ |
||
| 65 | __DIR__.'/../database/migrations/'.$migrationFileName.'.php.stub' => database_path('migrations/'.Carbon::now()->format('Y_m_d_Hmsu').'_'.$migrationFileName.'.php'), |
||
| 66 | ], 'migrations'); |
||
| 67 | } |
||
| 86 |