AbstractApiEnablement   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

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 public function getApiName();
18
    abstract public function getApiDescription();
19
    abstract public function getValue();
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
}