Test Failed
Branch feature__set_up_scrutinizer (ea6624)
by Robin
06:04 queued 02:46
created

Secure   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
eloc 8
dl 0
loc 32
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 10 3
1
<?php
2
3
namespace App\Commands\Site;
4
5
use App\Commands\BaseCommand;
6
use App\Models\Site;
7
8
class Secure extends BaseCommand
9
{
10
    /**
11
     * The signature of the command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'site:secure {site?}';
16
17
    /**
18
     * The description of the command.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Set up a site to use https';
23
24
    /**
25
     * Execute the console command.
26
     *
27
     * @return void
28
     * @throws \Exception
29
     */
30
    public function handle(): void
31
    {
32
        $name = $this->argument('site') ?: Site::nameFromPath($this->cli->currentWorkingDirectory());
33
34
        if (! $name) {
35
            throw new \Exception("Site '{$name}' not found.");
36
        }
37
38
        $site = Site::firstOrCreateForName($name);
39
        $site->secure();
40
    }
41
}
42