Completed
Push — master ( fa9ba3...d6fa90 )
by Sergi Tur
14:50 queued 11:47
created

PublishAdminLTE::publishDatabaseConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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 View Code Duplication
    public function handle()
0 ignored issues
show
Duplication introduced by Sergi Tur Badenas
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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
        $this->publishDatabaseConfig();
76
    }
77
78
    /**
79
     * Install Home Controller.
80
     */
81
    private function publishHomeController()
82
    {
83
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::homeController());
84
    }
85
86
    /**
87
     * Change Auth Register controller.
88
     */
89
    private function changeRegisterController()
90
    {
91
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::registerController());
92
    }
93
94
    /**
95
     * Change Auth Login controller.
96
     */
97
    private function changeLoginController()
98
    {
99
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::loginController());
100
    }
101
102
    /**
103
     * Change Auth Forgot Password controller.
104
     */
105
    private function changeForgotPasswordController()
106
    {
107
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::forgotPasswordController());
108
    }
109
110
    /**
111
     * Change Auth Reset Password controller.
112
     */
113
    private function changeResetPasswordController()
114
    {
115
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::resetPasswordController());
116
    }
117
118
    /**
119
     * Install public assets.
120
     */
121
    private function publishPublicAssets()
122
    {
123
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::publicAssets());
124
    }
125
126
    /**
127
     * Install views.
128
     */
129
    private function publishViews()
130
    {
131
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::viewsToOverwrite());
132
    }
133
134
    /**
135
     * Install resource assets.
136
     */
137
    private function publishResourceAssets()
138
    {
139
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::resourceAssets());
140
    }
141
142
    /**
143
     * Install resource assets.
144
     */
145
    private function publishTests()
146
    {
147
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::tests());
148
    }
149
150
    /**
151
     * Install language assets.
152
     */
153
    private function publishLanguages()
154
    {
155
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::languages());
156
    }
157
158
    /**
159
     * Install gravatar config file.
160
     */
161
    private function publishGravatar()
162
    {
163
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::gravatar());
164
    }
165
166
    /**
167
     * Publish adminlte package config.
168
     */
169
    private function publishConfig()
170
    {
171
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::config());
172
    }
173
174
    /**
175
     * Publish routes/web.php file.
176
     */
177
    private function publishWebRoutes()
178
    {
179
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::webroutes());
180
    }
181
182
    /**
183
     * Publish routes/api.php file.
184
     */
185
    private function publishApiRoutes()
186
    {
187
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::apiroutes());
188
    }
189
190
    /**
191
     * Publish dusk tests files.
192
     */
193
    private function publishDusk()
194
    {
195
        $this->publishDuskEnvironment();
196
        $this->publishAppServiceProvider();
197
    }
198
199
    /**
200
     * Publish dusk environment files.
201
     */
202
    private function publishDuskEnvironment()
203
    {
204
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::duskEnvironment());
205
    }
206
207
    /**
208
     * Publish app/Providers/AppServiceProvider.php file.
209
     */
210
    private function publishAppServiceProvider()
211
    {
212
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::appServiceProviderClass());
213
    }
214
215
    /**
216
     * Publish config/database.php file.
217
     */
218
    private function publishDatabaseConfig()
219
    {
220
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::databaseConfig());
221
    }
222
223
    /**
224
     * Process options before running command.
225
     */
226
    private function processOptions()
227
    {
228
        $this->force = $this->option('force');
0 ignored issues
show
Documentation Bug introduced by Sergi Tur Badenas
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...
229
    }
230
}
231