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

RenewCertificates   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 27
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 6 2
1
<?php
2
3
namespace App\Commands\Site;
4
5
use App\Commands\BaseCommand;
6
use App\Models\Site;
7
use App\Support\Ssl\CertificateBuilder;
8
9
class RenewCertificates extends BaseCommand
10
{
11
    /**
12
     * The signature of the command.
13
     *
14
     * @var string
15
     */
16
    protected $signature = 'site:renew-certs {--clear-ca}';
17
18
    /**
19
     * The description of the command.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Renew certificates';
24
25
    /**
26
     * Execute the console command.
27
     *
28
     * @return void
29
     */
30
    public function handle(): void
31
    {
32
        app(CertificateBuilder::class)->clearDirectory((bool) $this->option('clear-ca'));
33
34
        foreach (Site::where('secure', true)->get() as $site) {
35
            $site->buildCertificate();
36
        }
37
    }
38
}
39