GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

PanelServiceProvider::register()   B
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 93

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 93
rs 8.1527
c 0
b 0
f 0
cc 2
nc 1
nop 0

How to fix   Long Method   

Long Method

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:

1
<?php namespace Serverfireteam\Panel;
2
3
use Illuminate\Support\ServiceProvider;
4
use Illuminate\Foundation\AliasLoader;
5
use Illuminate\Support\Facades\Route;
6
use Illuminate\Translation;
7
use Serverfireteam\Panel\Facades\LinksFacade;
8
use Serverfireteam\Panel\libs;
9
use Illuminate\Filesystem\Filesystem;
10
use Illuminate\Foundation;
11
use Serverfireteam\Panel\Commands;
12
use Serverfireteam\Panel\Links\ConfigLinkProvider;
13
use Serverfireteam\Panel\Links\DbLinkProvider;
14
use Serverfireteam\Panel\Links\LinkProvider;
15
16
class PanelServiceProvider extends ServiceProvider
17
{
18
    protected $defer = false;
19
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
114
    public function boot()
115
    {
116
        $this->loadViewsFrom(__DIR__.'/../../views', 'panelViews');
117
        $this->publishes([
118
            __DIR__.'/../../views' => base_path('resources/views/vendor/panelViews'),
119
            ], 'panelviews');
120
121
        include __DIR__."/../../routes.php";
122
123
        $this->loadTranslationsFrom(__DIR__.'/../../lang', 'panel');
124
        $this->loadTranslationsFrom(base_path() . '/vendor/serverfireteam/rapyd-laravel/lang', 'rapyd');
125
126
        AliasLoader::getInstance()->alias('Serverfireteam', 'Serverfireteam\Panel\Serverfireteam');
127
128
129
    }
130
131
    /**
132
     * Get the services provided by the provider.
133
     *
134
     * @return array
135
     */
136
    public function provides()
137
    {
138
        return array();
139
    }
140
}
141