| Conditions | 2 | 
| Paths | 2 | 
| Total Lines | 66 | 
| Code Lines | 31 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 2 | ||
| 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 | ||
| 53 | public function boot(LocalisationRegistrar $localisationLoader, Filesystem $filesystem, Router $router) | ||
| 54 |     { | ||
| 55 | $this->loadRoutesFrom(__DIR__.'/../routes/web.php'); | ||
| 56 | |||
| 57 |         if (true === function_exists('config_path')) { | ||
| 58 |             $timestamp = date('Y_m_d_His', mktime(0, 0, 0, 1, 1, 2000)); | ||
| 59 | // function not available and 'publish' not relevant in Lumen | ||
| 60 | $this->publishes( | ||
| 61 | [ | ||
| 62 |                     __DIR__.'/../config/localisation.php' => config_path('pwweb/localisation.php'), | ||
| 63 | ], | ||
| 64 | 'pwweb.localisation.config' | ||
| 65 | ); | ||
| 66 | |||
| 67 | $this->publishes( | ||
| 68 | [ | ||
| 69 |                     __DIR__.'/Database/Migrations/create_localisation_tables.php.stub' => $this->app->databasePath()."/migrations/{$timestamp}_create_localisation_tables.php", | ||
| 70 | ], | ||
| 71 | 'pwweb.localisation.migrations' | ||
| 72 | ); | ||
| 73 | |||
| 74 | $this->publishes( | ||
| 75 | [ | ||
| 76 |                     __DIR__.'/resources/lang' => resource_path('lang/vendor/pwweb'), | ||
| 77 | ], | ||
| 78 | 'pwweb.localisation.language' | ||
| 79 | ); | ||
| 80 | |||
| 81 | $this->publishes( | ||
| 82 | [ | ||
| 83 |                     __DIR__.'/resources/views' => base_path('resources/views/vendor/localisation'), | ||
| 84 | ], | ||
| 85 | 'pwweb.localisation.views' | ||
| 86 | ); | ||
| 87 | }//end if | ||
| 88 | |||
| 89 | $this->commands( | ||
| 90 | [ | ||
| 91 | Commands\CacheReset::class, | ||
| 92 | ] | ||
| 93 | ); | ||
| 94 | |||
| 95 | $this->loadTranslationsFrom(realpath(__DIR__.'/resources/lang'), 'pwweb'); | ||
| 96 | |||
| 97 | $this->registerModelBindings(); | ||
| 98 | |||
| 99 | $localisationLoader->clearClassLanguages(); | ||
| 100 | $localisationLoader->registerLanguages(); | ||
| 101 | |||
| 102 |         $this->app->bind('localisation', \PWWEB\Localisation\Localisation::class); | ||
| 103 | $loader = AliasLoader::getInstance(); | ||
| 104 |         $loader->alias('Localisation', \PWWEB\Localisation\Facades\Localisation::class); | ||
| 105 | |||
| 106 | $this->app->singleton( | ||
| 107 | LocalisationRegistrar::class, | ||
| 108 |             function ($app) use ($localisationLoader) { | ||
|  | |||
| 109 | return $localisationLoader; | ||
| 110 | } | ||
| 111 | ); | ||
| 112 | |||
| 113 | // Bind an instance of the language repository to the container. | ||
| 114 | $languageRepo = new \PWWEB\Localisation\Repositories\LanguageRepository($this->app); | ||
| 115 | $this->app->instance(\PWWEB\Localisation\Repositories\LanguageRepository::class, $languageRepo); | ||
| 116 | |||
| 117 | // Register the local middleware with the application. | ||
| 118 |         $router->middlewareGroup('localisation', [\PWWEB\Localisation\Middleware\Locale::class]); | ||
| 119 | } | ||
| 161 | 
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.