Conditions | 7 |
Paths | 36 |
Total Lines | 52 |
Code Lines | 26 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | 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 |
||
19 | public function boot() |
||
20 | { |
||
21 | /* |
||
22 | * Optional methods to load your package assets |
||
23 | */ |
||
24 | // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'mongicommerce'); |
||
25 | $this->loadViewsFrom(__DIR__.'/../resources/views', 'mongicommerce'); |
||
|
|||
26 | $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
||
27 | $this->loadRoutesFrom(__DIR__.'/routes.php'); |
||
28 | |||
29 | if(Schema::hasTable('admin_settings')){ |
||
30 | //inject global information into views |
||
31 | View::share('mongicommerce', AdminSetting::first()); |
||
32 | } |
||
33 | |||
34 | if(Schema::hasTable('categories')){ |
||
35 | //inject global information into views |
||
36 | View::share('categories', Template::getStructureCategories()); |
||
37 | } |
||
38 | |||
39 | |||
40 | if ($this->app->runningInConsole()) { |
||
41 | |||
42 | $config_file = config_path('mongicommerce.php'); |
||
43 | if(file_exists($config_file)){ |
||
44 | File::delete($config_file); |
||
45 | } |
||
46 | |||
47 | // Publishing the config file. |
||
48 | $this->publishes([ |
||
49 | __DIR__.'/../config/config.php' => config_path('mongicommerce.php'), |
||
50 | ], 'config'); |
||
51 | |||
52 | if(file_exists(resource_path('/views/mongicommerce'))){ |
||
53 | File::deleteDirectory(resource_path('/views/mongicommerce')); |
||
54 | } |
||
55 | // Publishing the views. |
||
56 | $this->publishes([ |
||
57 | __DIR__.'/../resources/views/shop' => resource_path('/views/mongicommerce'), |
||
58 | ], 'views'); |
||
59 | |||
60 | if(file_exists(public_path('/mongicommerce/template'))){ |
||
61 | File::deleteDirectory(public_path('/mongicommerce/template')); |
||
62 | } |
||
63 | // Publishing assets. |
||
64 | $this->publishes([ |
||
65 | __DIR__.'/../resources/assets' => public_path('/mongicommerce/template'), |
||
66 | ], 'assets'); |
||
67 | |||
68 | // Registering package commands. |
||
69 | $this->commands([ |
||
70 | InstallPackage::class |
||
71 | ]); |
||
95 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.