Completed
Push — master ( fc3d6f...f7b1d9 )
by Sergi Tur
28:05
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 View Code Duplication
    public function handle()
0 ignored issues
show
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->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');
238
    }
239
}
240