Nginx::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 14
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 6
1
<?php
2
3
namespace App\Commands\Site;
4
5
use App\Commands\BaseCommand;
6
use App\Models\Site;
7
use App\Support\Nginx\AvailableConfigurations;
8
9
class Nginx extends BaseCommand
10
{
11
    /**
12
     * The signature of the command.
13
     *
14
     * @var string
15
     */
16
    protected $signature = 'site:nginx {site?}';
17
18
    /**
19
     * The description of the command.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Choose the NGiNX config template for a site';
24
25
    /**
26
     * Execute the console command.
27
     *
28
     * @throws \Exception
29
     * @throws \Throwable
30
     *
31
     * @return void
32
     */
33
    public function handle(): void
34
    {
35
        $site = Site::resolveFromPathOrCurrentWorkingDirectoryOrFail((string) $this->argument('site'));
36
37
        $option = $this->menu(
38
            'Available Nginx Types',
39
            (new AvailableConfigurations())->getList($site->nginx_conf)
40
        )->open();
41
42
        if (!$option) {
43
            return;
44
        }
45
46
        $site->setNginxType($option);
47
    }
48
}
49