Completed
Push — master ( bd1796...39e185 )
by Sergi Tur
06:06
created

PublishAdminLTE   A

Complexity

Total Complexity 20

Size/Duplication

Total Lines 211
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 20
c 4
b 0
f 0
lcom 1
cbo 2
dl 0
loc 211
rs 10

20 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A publishHomeController() 0 4 1
A changeRegisterController() 0 4 1
A changeLoginController() 0 4 1
A changeForgotPasswordController() 0 4 1
A changeResetPasswordController() 0 4 1
A publishPublicAssets() 0 4 1
A publishViews() 0 4 1
A publishResourceAssets() 0 4 1
A publishTests() 0 4 1
A publishLanguages() 0 4 1
A publishGravatar() 0 4 1
A publishConfig() 0 4 1
A publishWebRoutes() 0 4 1
A publishApiRoutes() 0 4 1
A handle() 0 21 1
A publishDusk() 0 5 1
A publishDuskEnvironment() 0 4 1
A publishAppServiceProvider() 0 4 1
A processOptions() 0 4 1
1
<?php
2
3
namespace Acacha\AdminLTETemplateLaravel\Console;
4
5
use Illuminate\Console\Command;
6
use Illuminate\Filesystem\Filesystem;
7
8
/**
9
 * Class PublishAdminLTE.
10
 */
11
class PublishAdminLTE extends Command
12
{
13
    use Installable;
14
    /**
15
     * The filesystem instance.
16
     *
17
     * @var \Illuminate\Filesystem\Filesystem
18
     */
19
    protected $files;
20
21
    /**
22
     * The name and signature of the console command.
23
     */
24
    protected $signature = 'adminlte-laravel:publish {--f|force : Force overwrite of files}';
25
26
    /**
27
     * The console command description.
28
     *
29
     * @var string
30
     */
31
    protected $description = 'Publish Acacha AdminLTE Template files into laravel project';
32
33
    /**
34
     * Force overwrite of files.
35
     *
36
     * @var bool
37
     */
38
    protected $force = false;
39
40
    /**
41
     * Create a new command instance.
42
     *
43
     * @param \Illuminate\Filesystem\Filesystem $files
44
     *
45
     */
46
    public function __construct(Filesystem $files)
47
    {
48
        parent::__construct();
49
        $this->files = $files;
50
    }
51
52
    /**
53
     * Execute the console command.
54
     */
55
    public function handle()
56
    {
57
        $this->processOptions();
58
59
        //Publish
60
        $this->publishHomeController();
61
        $this->changeRegisterController();
62
        $this->changeLoginController();
63
        $this->changeForgotPasswordController();
64
        $this->changeResetPasswordController();
65
        $this->publishPublicAssets();
66
        $this->publishViews();
67
        $this->publishResourceAssets();
68
        $this->publishTests();
69
        $this->publishLanguages();
70
        $this->publishGravatar();
71
        $this->publishConfig();
72
        $this->publishWebRoutes();
73
        $this->publishApiRoutes();
74
        $this->publishDusk();
75
    }
76
77
    /**
78
     * Install Home Controller.
79
     */
80
    private function publishHomeController()
81
    {
82
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::homeController());
83
    }
84
85
    /**
86
     * Change Auth Register controller.
87
     */
88
    private function changeRegisterController()
89
    {
90
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::registerController());
91
    }
92
93
    /**
94
     * Change Auth Login controller.
95
     */
96
    private function changeLoginController()
97
    {
98
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::loginController());
99
    }
100
101
    /**
102
     * Change Auth Forgot Password controller.
103
     */
104
    private function changeForgotPasswordController()
105
    {
106
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::forgotPasswordController());
107
    }
108
109
    /**
110
     * Change Auth Reset Password controller.
111
     */
112
    private function changeResetPasswordController()
113
    {
114
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::resetPasswordController());
115
    }
116
117
    /**
118
     * Install public assets.
119
     */
120
    private function publishPublicAssets()
121
    {
122
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::publicAssets());
123
    }
124
125
    /**
126
     * Install views.
127
     */
128
    private function publishViews()
129
    {
130
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::viewsToOverwrite());
131
    }
132
133
    /**
134
     * Install resource assets.
135
     */
136
    private function publishResourceAssets()
137
    {
138
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::resourceAssets());
139
    }
140
141
    /**
142
     * Install resource assets.
143
     */
144
    private function publishTests()
145
    {
146
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::tests());
147
    }
148
149
    /**
150
     * Install language assets.
151
     */
152
    private function publishLanguages()
153
    {
154
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::languages());
155
    }
156
157
    /**
158
     * Install gravatar config file.
159
     */
160
    private function publishGravatar()
161
    {
162
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::gravatar());
163
    }
164
165
    /**
166
     * Publish adminlte package config.
167
     */
168
    private function publishConfig()
169
    {
170
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::config());
171
    }
172
173
    /**
174
     * Publish routes/web.php file.
175
     */
176
    private function publishWebRoutes()
177
    {
178
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::webroutes());
179
    }
180
181
    /**
182
     * Publish routes/api.php file.
183
     */
184
    private function publishApiRoutes()
185
    {
186
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::apiroutes());
187
    }
188
189
    /**
190
     * Publish dusk tests files.
191
     */
192
    private function publishDusk()
193
    {
194
        $this->publishDuskEnvironment();
195
        $this->publishAppServiceProvider();
196
    }
197
198
    /**
199
     * Publish dusk environment files.
200
     */
201
    private function publishDuskEnvironment()
202
    {
203
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::duskEnvironment());
204
    }
205
206
    /**
207
     * Publish app/Providers/AppServiceProvider.php file.
208
     */
209
    private function publishAppServiceProvider()
210
    {
211
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::appServiceProviderClass());
212
    }
213
214
    /**
215
     * Process options before running command.
216
     */
217
    private function processOptions()
218
    {
219
        $this->force = $this->option('force');
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->option('force') of type string or array is incompatible with the declared type boolean of property $force.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
220
    }
221
}
222