PublishCommand::handle()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
cc 3
nc 3
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cortex\Console\Console\Commands;
6
7
use Illuminate\Console\Command;
8
9
class PublishCommand extends Command
10
{
11
    /**
12
     * The name and signature of the console command.
13
     *
14
     * @var string
15
     */
16
    protected $signature = 'cortex:publish:console {--force : Overwrite any existing files.} {--R|resource=all}';
17
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Publish Cortex Console Resources.';
24
25
    /**
26
     * Execute the console command.
27
     *
28
     * @return void
29
     */
30
    public function handle(): void
31
    {
32
        $this->alert($this->description);
33
34
        switch ($this->option('resource')) {
35
            case 'lang':
36
                $this->call('vendor:publish', ['--tag' => 'cortex-console-lang', '--force' => $this->option('force')]);
37
                break;
38
            case 'views':
39
                $this->call('vendor:publish', ['--tag' => 'cortex-console-views', '--force' => $this->option('force')]);
40
                break;
41
            default:
42
                $this->call('vendor:publish', ['--tag' => 'cortex-console-lang', '--force' => $this->option('force')]);
43
                $this->call('vendor:publish', ['--tag' => 'cortex-console-views', '--force' => $this->option('force')]);
44
                break;
45
        }
46
47
        $this->line('');
48
    }
49
}
50