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

Command   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 23
ccs 9
cts 9
cp 1
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 3 1
A __call() 0 10 3
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