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

AddToList::fire()   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
dl 0
loc 3
c 1
b 0
f 0
rs 10
cc 1
eloc 1
nc 1
nop 0
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