MakeFiles   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 12
c 1
b 0
f 0
dl 0
loc 41
ccs 10
cts 10
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 20 4
1
<?php
2
3
namespace App\Commands;
4
5
use App\Models\Site;
6
use App\Support\Ssl\CertificateBuilder;
7
8
class MakeFiles extends BaseCommand
9
{
10
    /**
11
     * The signature of the command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'make-files';
16
17
    /**
18
     * The description of the command.
19
     *
20
     * @var string
21
     */
22
    protected $description = '(Re)make the files we need';
23
24
    /**
25
     * Execute the console command.
26
     *
27
     * @return void
28
     */
29 4
    public function handle(): void
30
    {
31 4
        $wasUp = $this->porter->isUp();
32
33 4
        if ($wasUp) {
34 1
            $this->call('stop');
35
        }
36
37 4
        $this->porter->compose();
38
39 4
        foreach (Site::all() as $site) {
40 2
            $site->buildFiles();
41
        }
42
43
        // The porter_default certificate is used for serving error pages
44
        // when a domain has not been set up in Porter
45 4
        app(CertificateBuilder::class)->build('porter_default');
46
47 4
        if ($wasUp) {
48 1
            $this->call('start');
49
        }
50
    }
51
}
52