Unsecure::handle()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 10
ccs 0
cts 6
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\Site;
4
5
use App\Commands\BaseCommand;
6
use App\Models\Site;
7
8
class Unsecure extends BaseCommand
9
{
10
    /**
11
     * The signature of the command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'site:unsecure {site?}';
16
17
    /**
18
     * The description of the command.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Set up a site to use http';
23
24
    /**
25
     * Execute the console command.
26
     *
27
     * @throws \Exception
28
     *
29
     * @return void
30
     */
31
    public function handle(): void
32
    {
33
        $name = $this->argument('site') ?: Site::nameFromPath($this->cli->currentWorkingDirectory());
34
35
        if (!$name) {
36
            throw new \Exception("Site '{$name}' not found.");
37
        }
38
39
        $site = Site::firstOrCreateForName($name);
40
        $site->unsecure();
41
    }
42
}
43