AbstractApiEnablement::getApiName()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
c 0
b 0
f 0
nc 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
}