1 | <?php |
||
2 | |||
3 | namespace Itstructure\MultiMenu\Commands; |
||
4 | |||
5 | use Illuminate\Console\Command; |
||
6 | use Itstructure\MultiMenu\MultiMenuServiceProvider; |
||
7 | |||
8 | /** |
||
9 | * Class PublishCommand |
||
10 | * |
||
11 | * @package Itstructure\MultiMenu\Commands |
||
12 | * |
||
13 | * @author Andrey Girnik <[email protected]> |
||
14 | */ |
||
15 | class PublishCommand extends Command |
||
16 | { |
||
17 | /** |
||
18 | * The name and signature of the console command. |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $signature = 'multimenu:publish '. |
||
22 | '{--force : Overwrite existing files by default. This option can not be used.}'. |
||
23 | '{--only= : Publish only specific part. Available parts: config, views. This option can not be used.}'; |
||
24 | |||
25 | /** |
||
26 | * The console command description. |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $description = 'Publish the Multi menu package parts.'; |
||
30 | |||
31 | /** |
||
32 | * Execute the console command. |
||
33 | * @return void |
||
34 | */ |
||
35 | public function handle() |
||
36 | { |
||
37 | $this->info('Starting publication process of Multi menu package parts...'); |
||
38 | |||
39 | $callArguments = ['--provider' => MultiMenuServiceProvider::class]; |
||
40 | |||
41 | if ($this->option('only')) { |
||
42 | switch ($this->option('only')) { |
||
43 | case 'config': |
||
44 | $this->info('Publish just a part: config.'); |
||
45 | $callArguments['--tag'] = 'config'; |
||
46 | break; |
||
47 | |||
48 | case 'views': |
||
49 | $this->info('Publish just a part: views.'); |
||
50 | $callArguments['--tag'] = 'views'; |
||
51 | break; |
||
52 | |||
53 | default: |
||
54 | $this->error('Invalid "only" argument value!'); |
||
55 | return; |
||
56 | break; |
||
0 ignored issues
–
show
|
|||
57 | } |
||
58 | |||
59 | } else { |
||
60 | $this->info('Publish all parts: config, views.'); |
||
61 | } |
||
62 | |||
63 | if ($this->option('force')) { |
||
64 | $this->warn('Force publishing.'); |
||
65 | $callArguments['--force'] = true; |
||
66 | } |
||
67 | |||
68 | $this->call('vendor:publish', $callArguments); |
||
69 | } |
||
70 | } |
||
71 |
The
break
statement is not necessary if it is preceded for example by areturn
statement:If you would like to keep this construct to be consistent with other
case
statements, you can safely mark this issue as a false-positive.