AbstractPluginCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 39
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fire() 0 6 1
A getArguments() 0 6 1
1
<?php
2
3
/*
4
 * This file is part of Rocketeer
5
 *
6
 * (c) Maxime Fabre <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 */
12
13
namespace Rocketeer\Console\Commands;
14
15
use Symfony\Component\Console\Input\InputArgument;
16
use Symfony\Component\Console\Output\OutputInterface;
17
18
/**
19
 * An abstract from commands related to plugins.
20
 */
21
class AbstractPluginCommand extends AbstractCommand
22
{
23
    /**
24
     * The plugin task to fire.
25
     *
26
     * @var string
27
     */
28
    protected $pluginTask;
29
30
    /**
31
     * Whether the command's task should be built
32
     * into a pipeline or run straight.
33
     *
34
     * @var bool
35
     */
36
    protected $straight = true;
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function fire()
42
    {
43
        $this->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
0 ignored issues
show
Documentation Bug introduced by Maxime Fabre
The method setVerbosity does not exist on object<Rocketeer\Console...\AbstractPluginCommand>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
44
45
        return $this->fireTasksQueue($this->pluginTask);
46
    }
47
48
    /**
49
     * Get the console command arguments.
50
     *
51
     * @return string[][]
52
     */
53
    protected function getArguments()
54
    {
55
        return [
56
            ['package', InputArgument::OPTIONAL, 'The package to publish the configuration for'],
57
        ];
58
    }
59
}
60