EmptyCommand::fire()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Vinelab\Cdn\Commands;
4
5
use Illuminate\Console\Command;
6
use Vinelab\Cdn\Contracts\CdnInterface;
7
8
/**
9
 * Class PushCommand.
10
 *
11
 * @category Command
12
 *
13
 * @author   Mahmoud Zalt <[email protected]>
14
 */
15 View Code Duplication
class EmptyCommand extends Command
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
{
17
    /**
18
     * The console command name.
19
     *
20
     * @var string
21
     */
22
    protected $name = 'cdn:empty';
23
24
    /**
25
     * The console command description.
26
     *
27
     * @var string
28
     */
29
    protected $description = 'Empty all assets from CDN';
30
31
    /**
32
     * an instance of the main Cdn class.
33
     *
34
     * @var Vinelab\Cdn\Cdn
35
     */
36
    protected $cdn;
37
38
    /**
39
     * @param CdnInterface $cdn
40
     */
41
    public function __construct(CdnInterface $cdn)
42
    {
43
        $this->cdn = $cdn;
0 ignored issues
show
Documentation Bug introduced by
It seems like $cdn of type object<Vinelab\Cdn\Contracts\CdnInterface> is incompatible with the declared type object<Vinelab\Cdn\Commands\Vinelab\Cdn\Cdn> of property $cdn.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
44
45
        parent::__construct();
46
    }
47
48
    /**
49
     * Execute the console command.
50
     *
51
     * @return mixed
52
     */
53
    public function fire()
54
    {
55
        $this->cdn->emptyBucket();
56
    }
57
58
    /**
59
     * Get the console command arguments.
60
     *
61
     * @return array
62
     */
63
    protected function getArguments()
64
    {
65
        return array(
66
//			array('cdn', InputArgument::OPTIONAL, 'cdn option.'),
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
67
        );
68
    }
69
70
    /**
71
     * Get the console command options.
72
     *
73
     * @return array
74
     */
75
    protected function getOptions()
76
    {
77
        return array(
78
//			array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null),
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
79
        );
80
    }
81
}
82