Completed
Push — master ( 6f8365...5411bf )
by Sergi Tur
01:55
created

PublishAdminLTE::publishFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
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
    
14
    use Installable;
15
    /**
16
     * The filesystem instance.
17
     *
18
     * @var \Illuminate\Filesystem\Filesystem
19
     */
20
    protected $files;
21
22
    /**
23
     * The name and signature of the console command.
24
     */
25
    protected $signature = 'adminlte-laravel:publish {--f|force : Force overwrite of files}';
26
27
    /**
28
     * The console command description.
29
     *
30
     * @var string
31
     */
32
    protected $description = 'Publish Acacha AdminLTE Template files into laravel project';
33
34
    /**
35
     * Force overwrite of files.
36
     *
37
     * @var bool
38
     */
39
    protected $force = false;
40
41
    /**
42
     * Create a new command instance.
43
     *
44
     * @param \Illuminate\Filesystem\Filesystem $files
45
     *
46
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
47
     */
48
    public function __construct(Filesystem $files)
49
    {
50
        parent::__construct();
51
        $this->files = $files;
52
    }
53
54
    /**
55
     * Execute the console command.
56
     */
57 View Code Duplication
    public function handle()
0 ignored issues
show
Duplication introduced by
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...
58
    {
59
        $this->processOptions();
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
    }
72
73
    /**
74
     * Install Home Controller.
75
     */
76
    private function publishHomeController()
77
    {
78
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::homeController());
79
    }
80
81
    /**
82
     * Change Auth Register controller.
83
     */
84
    private function changeRegisterController()
85
    {
86
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::registerController());
87
    }
88
89
    /**
90
     * Change Auth Login controller.
91
     */
92
    private function changeLoginController()
93
    {
94
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::loginController());
95
    }
96
97
    /**
98
     * Change Auth Forgot Password controller.
99
     */
100
    private function changeForgotPasswordController()
101
    {
102
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::forgotPasswordController());
103
    }
104
105
    /**
106
     * Change Auth Reset Password controller.
107
     */
108
    private function changeResetPasswordController()
109
    {
110
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::resetPasswordController());
111
    }
112
113
    /**
114
     * Install public assets.
115
     */
116
    private function publishPublicAssets()
117
    {
118
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::publicAssets());
119
    }
120
121
    /**
122
     * Install views.
123
     */
124
    private function publishViews()
125
    {
126
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::viewsToOverwrite());
127
    }
128
129
    /**
130
     * Install resource assets.
131
     */
132
    private function publishResourceAssets()
133
    {
134
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::resourceAssets());
135
    }
136
137
    /**
138
     * Install resource assets.
139
     */
140
    private function publishTests()
141
    {
142
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::tests());
143
    }
144
145
    /**
146
     * Install language assets.
147
     */
148
    private function publishLanguages()
149
    {
150
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::languages());
151
    }
152
153
    /**
154
     * Install gravatar config file.
155
     */
156
    private function publishGravatar()
157
    {
158
        $this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::gravatar());
159
    }
160
161
    /**
162
     * Process options before running command.
163
     */
164
    private function processOptions()
165
    {
166
        $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...
167
    }
168
}
169