Test Failed
Pull Request — master (#85)
by Keoghan
06:33
created

Home::handle()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 14
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0
cc 3
nc 2
nop 0
crap 12
1
<?php
2
3
namespace App\Commands;
4
5
use App\Models\Setting;
6
7
class Home extends BaseCommand
8
{
9
    /**
10
     * The signature of the command.
11
     *
12
     * @var string
13
     */
14
    protected $signature = 'home {path?} {--show}';
15
16
    /**
17
     * The description of the command.
18
     *
19
     * @var string
20
     */
21
    protected $description = 'Set the root directory for Porter sites';
22
23
    /**
24
     * Execute the console command.
25
     *
26
     * @return void
27
     */
28
    public function handle(): void
29
    {
30
        if ($this->option('show')) {
31
            $this->info('Home is currently: '.setting('home'));
32
33
            return;
34
        }
35
36
        $path = realpath((string) $this->argument('path') ?: $this->cli->currentWorkingDirectory());
37
38
        $this->info('Setting home to '.$path);
39
40
        Setting::updateOrCreate('home', $path);
41
        $this->call('make-files');
42
    }
43
}
44