Completed
Push — master ( c540fc...cbb59f )
by Oleg
01:55
created

AllActionsCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 32
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 11 2
A configure() 0 6 1
1
<?php
2
declare(strict_types=1);
3
4
namespace SlayerBirden\DFCodeGeneration\Command\Controllers;
5
6
use SlayerBirden\DFCodeGeneration\Command\AbstractApiCommand;
7
use Symfony\Component\Console\Input\ArrayInput;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
final class AllActionsCommand extends AbstractApiCommand
12
{
13
    private $commands = [
14
        'action:add',
15
        'action:delete',
16
        'action:get',
17
        'action:gets',
18
        'action:update',
19
    ];
20
21
    protected function configure()
22
    {
23
        parent::configure();
24
        $this->setName('action:all')
25
            ->setDescription('All action controllers and support configuration.')
26
            ->setHelp('This command creates all Actions for given entity.');
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    protected function execute(InputInterface $input, OutputInterface $output)
33
    {
34
        foreach ($this->commands as $commandName) {
35
            $command = $this->getApplication()->find($commandName);
36
37
            $arguments = array(
38
                'entity' => $this->entityClassName,
39
                '--force' => $this->force,
40
            );
41
            $greetInput = new ArrayInput($arguments);
42
            $command->run($greetInput, $output);
43
        }
44
    }
45
}
46