Completed
Pull Request — master (#99)
by Kevin
06:07
created

AbstractApiEnablement::getApiDescription()

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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