Passed
Push — master ( 3d0d87...075b69 )
by Antonio Carlos
09:13
created

Clear::getOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 2
cts 2
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
crap 1
1
<?php
2
3
namespace PragmaRX\Firewall\Vendor\Laravel\Artisan;
4
5
use Symfony\Component\Console\Input\InputOption;
6
7
class Clear extends Base
8
{
9
    /**
10
     * The console command name.
11
     *
12
     * @var string
13
     */
14
    protected $name = 'firewall:clear';
15
16
    /**
17
     * The console command description.
18
     *
19
     * @var string
20
     */
21
    protected $description = 'Remove all ip addresses from white and black lists.';
22
23
    /**
24
     * Clear the list.
25
     *
26
     * @return mixed
27
     */
28 1
    public function fire()
29
    {
30 1
        if (!$this->option('force')) {
31
            $this->error('This command won\'t run unless you use --force.');
32
        } else {
33 1
            if (app('firewall')->clear()) {
34 1
                $this->info('List cleared.');
35
            } else {
36
                $this->info('There were no IP addresses to be deleted.');
37
            }
38
        }
39 1
    }
40
41
    /**
42
     * Get the console command options.
43
     *
44
     * @return array
45
     */
46 24
    protected function getOptions()
47
    {
48
        return [
49 24
            ['force', null, InputOption::VALUE_NONE, 'Remove IP before adding it to the list.'],
50
        ];
51
    }
52
}
53