PublishOpen::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Acacha\ForgePublish\Commands;
4
5
use Acacha\ForgePublish\Commands\Traits\ChecksEnv;
6
use Illuminate\Console\Command;
7
8
/**
9
 * Class PublishOpen.
10
 *
11
 * @package Acacha\ForgePublish\Commands
12
 */
13
class PublishOpen extends Command
14
{
15
    use ChecksEnv;
16
17
    /**
18
     * The name and signature of the console command.
19
     *
20
     * @var string
21
     */
22
    protected $signature = 'publish:open {--domain=}';
23
24
    /**
25
     * The console command description.
26
     *
27
     * @var string
28
     */
29
    protected $description = 'Open domain on your default (sensible-browser) browser';
30
31
    /**
32
     * Domain name.
33
     *
34
     * @var string
35
     */
36
    protected $domain;
37
38
    /**
39
     * Execute the console command.
40
     *
41
     */
42
    public function handle()
43
    {
44
        $this->abortCommandExecution();
45
46
        $this->info("Openning domain $this->domain");
47
48
        passthru("sensible-browser $this->domain");
49
    }
50
51
52
    /**
53
     * Abort command execution.
54
     */
55
    protected function abortCommandExecution()
56
    {
57
        $this->domain = $this->checkEnv('domain', 'ACACHA_FORGE_DOMAIN');
58
    }
59
}
60