AllActionsCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
ccs 0
cts 5
cp 0
crap 2
rs 10
c 0
b 0
f 0
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
            /** @var AbstractApiCommand $command */
36
            $command = $this->getApplication()->find($commandName);
37
            $command->setConfigProvider($this->getConfigProvider());
0 ignored issues
show
Bug introduced by
It seems like $this->getConfigProvider() can also be of type null; however, parameter $configProvider of SlayerBirden\DFCodeGener...nd::setConfigProvider() does only seem to accept SlayerBirden\DFCodeGener...ConfigProviderInterface, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

37
            $command->setConfigProvider(/** @scrutinizer ignore-type */ $this->getConfigProvider());
Loading history...
38
39
            $arguments = array(
40
                'command' => $commandName,
41
                'entity' => $this->entityClassName,
42
                '--force' => $this->force,
43
            );
44
            $greetInput = new ArrayInput($arguments);
45
            $command->run($greetInput, $output);
46
        }
47
    }
48
}
49