Passed
Push — dependabot/npm_and_yarn/docs/w... ( a770a9...3a5b31 )
by
unknown
07:47
created

Command::__call()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 5
c 1
b 0
f 0
nc 3
nop 2
dl 0
loc 10
ccs 6
cts 6
cp 1
crap 3
rs 10
1
<?php
2
3
namespace A17\Twill\Commands;
4
5
use Illuminate\Support\Str;
6
use Illuminate\Console\Command as IlluminateCommand;
7
8
abstract class Command extends IlluminateCommand
9
{
10
    protected $exitCode = 0;
11
12 5
    public function __call($method, $parameters)
13
    {
14 5
        if (Str::startsWith($method, 'display')) {
15 5
            $method = Str::camel(Str::after($method, 'display'));
16
17 5
            if ($method === 'error') {
18 3
                $this->exitCode = 1;
19
            }
20
21 5
            call_user_func_array([$this, $method], $parameters);
22
        }
23 5
    }
24
25
    /**
26
     * Executes the console command.
27
     */
28 6
    public function handle()
29
    {
30 6
        return $this->exitCode;
31
    }
32
}
33