Passed
Push — master ( 6bfad1...b9baef )
by Antonio Carlos
03:31
created

Base::fireCommand()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 4
nc 2
nop 2
1
<?php
2
3
namespace PragmaRX\Firewall\Vendor\Laravel\Artisan;
4
5
use Illuminate\Console\Command;
6
7
abstract class Base extends Command
8
{
9
    public function displayMessages($type, $messages)
10
    {
11
        foreach ($messages as $message) {
12
            $this->$type($message);
13
        }
14
    }
15
16
    public function handle()
17
    {
18
        $this->fire();
0 ignored issues
show
Bug introduced by
The method fire() does not exist on PragmaRX\Firewall\Vendor\Laravel\Artisan\Base. Since it exists in all sub-types, consider adding an abstract or default implementation to PragmaRX\Firewall\Vendor\Laravel\Artisan\Base. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

18
        $this->/** @scrutinizer ignore-call */ fire();
Loading history...
19
    }
20
21
    public function fireCommand($method, $parameters)
22
    {
23
        $type = call_user_func_array ( [$this->laravel->firewall, $method], $parameters)
0 ignored issues
show
Bug introduced by
Accessing firewall on the interface Illuminate\Contracts\Foundation\Application suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
24
            ? 'info'
25
            : 'error';
26
27
        $this->displayMessages($type, $this->laravel->firewall->getMessages());
28
    }
29
}
30