Passed
Push — master ( cf5135...8a1919 )
by Keoghan
07:16
created

Unproxy   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
c 1
b 0
f 0
dl 0
loc 29
ccs 6
cts 6
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 3
1
<?php
2
3
namespace App\Commands\Valet;
4
5
use App\Commands\BaseCommand;
6
use App\Models\Site;
7
use App\Support\Valet\Valet;
8
9
class Unproxy extends BaseCommand
10
{
11
    /**
12
     * The signature of the command.
13
     *
14
     * @var string
15
     */
16
    protected $signature = 'valet:unproxy {site?} {--all}';
17
18
    /**
19
     * The description of the command.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Manually remove a Valet proxy for a site';
24
25
    /**
26
     * Execute the console command.
27
     *
28
     * @return void
29
     */
30 2
    public function handle(): void
31
    {
32 2
        $sites = $this->option('all')
33 1
            ? Site::all()
34 2
            : [Site::resolveFromPathOrCurrentWorkingDirectoryOrFail((string) $this->argument('site'))];
35
36 2
        foreach($sites as $site) {
37 2
            app(Valet::class)->removeSite($site);
38
        }
39 2
    }
40
}
41