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

AddToList   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
dl 0
loc 47
c 1
b 0
f 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getArguments() 0 4 1
A getOptions() 0 4 1
A fire() 0 3 1
A __construct() 0 5 1
1
<?php
2
3
namespace PragmaRX\Firewall\Vendor\Laravel\Artisan;
4
5
use Symfony\Component\Console\Input\InputArgument;
6
use Symfony\Component\Console\Input\InputOption;
7
8
abstract class AddToList extends Base
9
{
10
    /**
11
     * The console command description.
12
     *
13
     * @var string
14
     */
15
    protected $description = 'Add an IP address to %s.';
16
17
    public function __construct()
18
    {
19
        parent::__construct();
20
21
        $this->description = sprintf($this->description, $this->listName);
22
    }
23
24
    /**
25
     * Execute the console command.
26
     *
27
     * @return mixed
28
     */
29
    public function fire()
30
    {
31
        $this->fireCommand($this->listName, [$this->argument('ip'), $this->option('force')]);
32
    }
33
34
    /**
35
     * Get the console command arguments.
36
     *
37
     * @return array
38
     */
39
    protected function getArguments()
40
    {
41
        return [
42
            ['ip', InputArgument::REQUIRED, 'The IP address to be added.'],
43
        ];
44
    }
45
46
    /**
47
     * Get the console command options.
48
     *
49
     * @return array
50
     */
51
    protected function getOptions()
52
    {
53
        return [
54
            ['force', null, InputOption::VALUE_NONE, 'Remove IP before adding it to the list.'],
55
        ];
56
    }
57
}
58