| Conditions | 4 |
| Paths | 8 |
| Total Lines | 54 |
| Code Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 10 | ||
| Bugs | 1 | Features | 1 |
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 |
||
| 24 | public function boot(Router $router, Kernel $kernel) |
||
|
|
|||
| 25 | { |
||
| 26 | |||
| 27 | Blade::directive('money', function ($amount) { |
||
| 28 | #return $fmt->formatCurrency($amount,"EUR"); |
||
| 29 | /*return "<?= $fmt->formatCurrency($amount,'EUR'); ?>";*/ |
||
| 30 | return "<?= abs($amount) > 1000 ? '€ ' .number_format($amount, 0, ',', '.') : '€ ' . number_format($amount, 2, ',', '.') ?>"; |
||
| 31 | }); |
||
| 32 | /* |
||
| 33 | * Optional methods to load your package assets |
||
| 34 | */ |
||
| 35 | // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'mongicommerce'); |
||
| 36 | $this->loadViewsFrom(__DIR__ . '/../resources/views', 'mongicommerce'); |
||
| 37 | $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); |
||
| 38 | $this->loadRoutesFrom(__DIR__ . '/routes.php'); |
||
| 39 | |||
| 40 | if (Schema::hasTable('admin_settings')) { |
||
| 41 | //inject global information into views |
||
| 42 | View::share('mongicommerce', AdminSetting::first()); |
||
| 43 | } |
||
| 44 | |||
| 45 | if (Schema::hasTable('categories')) { |
||
| 46 | //inject global information into views |
||
| 47 | View::share('categories', Template::getCategoryTree()); |
||
| 48 | } |
||
| 49 | |||
| 50 | #$router->middleware(AdminMiddleware::class); |
||
| 51 | $router->aliasMiddleware('admin',AdminMiddleware::class); |
||
| 52 | |||
| 53 | |||
| 54 | if ($this->app->runningInConsole()) { |
||
| 55 | |||
| 56 | |||
| 57 | // Publishing the config file. |
||
| 58 | $this->publishes([ |
||
| 59 | __DIR__ . '/../config/config.php' => config_path('mongicommerce.php'), |
||
| 60 | ], 'config'); |
||
| 61 | |||
| 62 | |||
| 63 | // Publishing the views. |
||
| 64 | $this->publishes([ |
||
| 65 | __DIR__ . '/../resources/views/shop' => resource_path('/views/mongicommerce'), |
||
| 66 | ], 'views'); |
||
| 67 | |||
| 68 | |||
| 69 | // Publishing assets. |
||
| 70 | $this->publishes([ |
||
| 71 | __DIR__ . '/../resources/assets' => public_path('/mongicommerce/template'), |
||
| 72 | ], 'assets'); |
||
| 73 | |||
| 74 | // Registering package commands. |
||
| 75 | $this->commands([ |
||
| 76 | InstallPackage::class, |
||
| 77 | UpdatePackage::class |
||
| 78 | ]); |
||
| 101 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.