PublishOpen   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 47
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 1
A abortCommandExecution() 0 4 1
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