Artisan   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 37
ccs 18
cts 18
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A title() 0 9 1
A run() 0 12 2
1
<?php
2
3
namespace MadWeb\Initializer\Actions;
4
5
use Illuminate\Console\Command;
6
7
class Artisan extends Action
8
{
9
    private $command;
10
11
    private $arguments;
12
13 108
    public function __construct(Command $artisanCommand, string $command, array $arguments = [])
14
    {
15 108
        parent::__construct($artisanCommand);
16
17 108
        $this->command = $command;
18 108
        $this->arguments = $arguments;
19 108
    }
20
21 24
    public function title(): string
22
    {
23 24
        return "<comment>Run artisan command:</comment> $this->command (".
24 24
            $this->getArtisanCommnad()
25 24
                ->getApplication()
26 24
                ->find($this->command)
27 24
                ->getDescription().
28 24
            ')';
29
    }
30
31 108
    public function run(): bool
32
    {
33 108
        $artisanCommand = $this->getArtisanCommnad();
34
35 108
        if ($artisanCommand->getOutput()->isVerbose()) {
36 12
            $artisanCommand->getOutput()->newLine();
37
38 12
            return ! $artisanCommand->call($this->command, $this->arguments);
39
        }
40
41 96
        return ! $artisanCommand->callSilent($this->command, $this->arguments);
42
    }
43
}
44