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

Proxy::handle()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 10
cc 3
nc 4
nop 0
crap 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 Proxy extends BaseCommand
10
{
11
    /**
12
     * The signature of the command.
13
     *
14
     * @var string
15
     */
16
    protected $signature = 'valet:proxy {site?} {--all}';
17
18
    /**
19
     * The description of the command.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Manually add 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)->addSite($site);
38
        }
39 2
    }
40
}
41