Completed
Push — master ( a64245...e0b49d )
by Manel
58:10 queued 28:11
created

src/Console/PublishAdminLTE.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
238
    }
239
}
240