Passed
Push — master ( 136870...398928 )
by Quentin
53:06 queued 43:01
created

Command::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 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
    public function __call($method, $parameters)
13
    {
14
        if (Str::startsWith($method, 'display')) {
15
            $method = Str::camel(Str::after($method, 'display'));
16
17
            if ($method === 'error') {
18
                $this->exitCode = 1;
19
            }
20
21
            call_user_func_array([$this, $method], $parameters);
22
        }
23
    }
24
25
    /**
26
     * Executes the console command.
27
     */
28
    public function handle()
29
    {
30
        return $this->exitCode;
31
    }
32
}
33