Completed
Push — master ( fdf082...9ad6b1 )
by Kevin
08:56 queued 05:59
created

AbstractApiEnablement   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
getApiName() 0 1 ?
getApiDescription() 0 1 ?
getValue() 0 1 ?
A configure() 0 5 1
A execute() 0 11 1
1
<?php
2
3
namespace Magium\Cli\Command;
4
5
use Magium\InvalidConfigurationException;
6
use Magium\NotFoundException;
7
use Symfony\Component\Console\Command\Command;
8
use Symfony\Component\Console\Input\ArrayInput;
9
use Symfony\Component\Console\Input\InputArgument;
10
use Symfony\Component\Console\Input\InputInterface;
11
use Symfony\Component\Console\Input\InputOption;
12
use Symfony\Component\Console\Output\OutputInterface;
13
14
abstract class AbstractApiEnablement extends Command
15
{
16
17
    abstract function getApiName();
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
18
    abstract function getApiDescription();
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
19
    abstract function getValue();
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
20
21
    protected function configure()
22
    {
23
        $this->setName('api:' . $this->getApiName());
24
        $this->setDescription($this->getApiDescription());
25
    }
26
27
    protected function execute(InputInterface $input, OutputInterface $output)
28
    {
29
        $command = $this->getApplication()->find('element:set');
30
        $input = new ArrayInput([
31
            'command'   => $command->getName(),
32
            'class'     => 'Magium\Util\Api\ApiConfiguration',
33
            'property'  => 'enabled',
34
            'value'     => $this->getValue(),
35
        ]);
36
        $command->run($input, $output);
37
    }
38
39
    
40
}