Passed
Pull Request — master (#36)
by Cristian
01:57
created

OpenIdeService::getConsoleOutput()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 6
1
<?php
2
3
namespace Webfactor\Laravel\Generators\Services;
4
5
use Webfactor\Laravel\Generators\Contracts\ServiceAbstract;
6
use Webfactor\Laravel\Generators\Contracts\ServiceInterface;
7
8
class OpenIdeService extends ServiceAbstract implements ServiceInterface
9
{
10
    public function getConsoleOutput() {
11
        $ide = $this->getIde();
12
13
        return $ide ? 'Opening all generated or edited files in '.$this->getIde() : 'Editor not defined - not opening files in IDE';
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 132 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
14
    }
15
16
    public function call()
17
    {
18
        if ($this->getIde()) {
19
            return $this->openInIde();
20
        }
21
    }
22
23
    protected function getIde()
24
    {
25
        return $this->command->option('ide') ?? env('APP_EDITOR') ?? config('app.editor') ?? false;
26
    }
27
28
    protected function openInIde()
29
    {
30
        if ($ideClass = config('webfactor.generators.ides.' . $this->getIde())) {
31
            (new $ideClass($this->command->filesToBeOpened))->open();
32
33
            return;
34
        }
35
36
        $this->command->error('There is no opener class for ide <comment>' . $this->getIde() . '</comment>');
37
    }
38
}
39