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

Domain   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 12
dl 0
loc 39
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 18 2
1
<?php
2
3
namespace App\Commands;
4
5
use App\Models\Setting;
6
use App\Support\Dnsmasq\Config;
7
8
class Domain extends BaseCommand
9
{
10
    /**
11
     * The signature of the command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'domain {domain?}';
16
17
    /**
18
     * The description of the command.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Set the domain for Porter sites';
23
24
    /**
25
     * Execute the console command.
26
     *
27
     * @return void
28
     */
29
    public function handle(): void
30
    {
31
        $domain = $this->argument('domain');
32
33
        if (!$domain) {
34
            $this->info(sprintf("The current domain is '%s'", setting('domain')));
35
36
            return;
37
        }
38
39
        $old = setting('domain');
40
41
        Setting::where('name', 'domain')->first()->update(['value' => $domain]);
42
43
        app()->make(Config::class)->updateDomain($old, $domain);
44
45
        $this->call('site:renew-certs');
46
        $this->call('make-files');
47
    }
48
}
49