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

Base   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
dl 0
loc 21
c 0
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A displayMessages() 0 4 2
A handle() 0 3 1
A fireCommand() 0 7 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