AllActionsCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 35
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 6 1
A execute() 0 14 2
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