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