| Conditions | 2 |
| Paths | 1 |
| Total Lines | 93 |
| 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 namespace Serverfireteam\Panel; |
||
| 20 | public function register() |
||
| 21 | { |
||
| 22 | $this->publishes([ |
||
| 23 | __DIR__.'/config/elfinder.php' => config_path('elfinder.php'), |
||
| 24 | ]); |
||
| 25 | |||
| 26 | // register zofe\rapyd |
||
| 27 | $this->app->register('Zofe\Rapyd\RapydServiceProvider'); |
||
| 28 | |||
| 29 | // 'Maatwebsite\Excel\ExcelServiceProvider' |
||
| 30 | $this->app->register('Maatwebsite\Excel\ExcelServiceProvider'); |
||
| 31 | |||
| 32 | // Barryvdh\Elfinder\ElfinderServiceProvider |
||
| 33 | $this->app->register('Barryvdh\Elfinder\ElfinderServiceProvider'); |
||
| 34 | |||
| 35 | |||
| 36 | $this->app['router']->aliasMiddleware('PanelAuth', 'Serverfireteam\Panel\libs\AuthMiddleware'); |
||
| 37 | |||
| 38 | //middleware Permission |
||
| 39 | $this->app['router']->aliasMiddleware( |
||
| 40 | 'PermissionPanel', 'Serverfireteam\Panel\libs\PermissionCheckMiddleware' |
||
| 41 | ); |
||
| 42 | |||
| 43 | // set config for Auth |
||
| 44 | |||
| 45 | \Config::set('auth.guards.panel', ['driver' => 'session','provider' => 'panel']); |
||
| 46 | \Config::set('auth.providers.panel', ['driver' => 'eloquent','model' => \Serverfireteam\Panel\Admin::class]); |
||
| 47 | \Config::set('auth.passwords.panel', ['provider' => 'panel','email' => 'panelViews::resetPassword','table' => 'password_resets','expire' => 60]); |
||
| 48 | |||
| 49 | /* |
||
| 50 | * Create aliases for the dependency. |
||
| 51 | */ |
||
| 52 | $loader = AliasLoader::getInstance(); |
||
| 53 | $loader->alias('Form', 'Collective\Html\FormFacade'); |
||
| 54 | $loader->alias('Html', 'Collective\Html\HtmlFacade'); |
||
| 55 | $loader->alias('Excel', 'Maatwebsite\Excel\Facades\Excel'); |
||
| 56 | |||
| 57 | $this->app->singleton('panel::install', function() |
||
| 58 | { |
||
| 59 | return new \Serverfireteam\Panel\Commands\PanelCommand(); |
||
| 60 | }); |
||
| 61 | |||
| 62 | $this->app->singleton('panel::crud', function() |
||
| 63 | { |
||
| 64 | return new \Serverfireteam\Panel\Commands\CrudCommand(); |
||
| 65 | }); |
||
| 66 | |||
| 67 | $this->app->singleton('panel::createmodel', function() |
||
| 68 | { |
||
| 69 | $fileSystem = new Filesystem(); |
||
| 70 | |||
| 71 | return new \Serverfireteam\Panel\Commands\CreateModelCommand($fileSystem); |
||
| 72 | }); |
||
| 73 | |||
| 74 | $this->app->singleton('panel::createobserver', function() |
||
| 75 | { |
||
| 76 | $fileSystem = new Filesystem(); |
||
| 77 | |||
| 78 | return new \Serverfireteam\Panel\Commands\CreateModelObserverCommand($fileSystem); |
||
| 79 | }); |
||
| 80 | |||
| 81 | $this->app->singleton('panel::createcontroller', function() |
||
| 82 | { |
||
| 83 | $fileSystem = new Filesystem(); |
||
| 84 | |||
| 85 | return new \Serverfireteam\Panel\Commands\CreateControllerPanelCommand($fileSystem); |
||
| 86 | }); |
||
| 87 | |||
| 88 | $this->app->singleton(LinkProvider::class, function () { |
||
| 89 | return app(config('panel.links') ? ConfigLinkProvider::class : DbLinkProvider::class); |
||
| 90 | }); |
||
| 91 | |||
| 92 | $loader->alias('Links', LinksFacade::class); |
||
| 93 | |||
| 94 | $this->commands('panel::createmodel'); |
||
| 95 | |||
| 96 | $this->commands('panel::createobserver'); |
||
| 97 | |||
| 98 | $this->commands('panel::createcontroller'); |
||
| 99 | |||
| 100 | $this->commands('panel::install'); |
||
| 101 | |||
| 102 | $this->commands('panel::crud'); |
||
| 103 | |||
| 104 | $this->publishes([ |
||
| 105 | __DIR__ . '/../../../public' => public_path('packages/serverfireteam/panel') |
||
| 106 | ], 'panelpublic'); |
||
| 107 | |||
| 108 | $this->publishes([ |
||
| 109 | __DIR__.'/config/panel.php' => config_path('panel.php'), |
||
| 110 | __DIR__.'/config/elfinder.php' => config_path('elfinder.php'), |
||
| 111 | ], 'panelconfig'); |
||
| 112 | } |
||
| 113 | |||
| 141 |