Passed
Push — feature/refactor-code-generato... ( 368fc0 )
by Chema
04:13
created

ConsoleBootstrap::getDefaultCommands()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 9
rs 10
ccs 5
cts 5
cp 1
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gacela\Console\Infrastructure;
6
7
use Gacela\Console\ConsoleFactory;
8
use Gacela\Framework\DocBlockResolverAwareTrait;
9
use Symfony\Component\Console\Application;
10
use Symfony\Component\Console\Command\Command;
11
12
/**
13
 * @method ConsoleFactory getFactory()
14
 */
15
final class ConsoleBootstrap extends Application
16
{
17
    use DocBlockResolverAwareTrait;
18
19
    /**
20
     * @return array<string,Command>
21
     *
22
     * @psalm-suppress MixedReturnTypeCoercion,PossiblyNullArrayOffset
23
     */
24 10
    protected function getDefaultCommands(): array
25
    {
26 10
        $commands = parent::getDefaultCommands();
27
28 10
        foreach ($this->getFactory()->getConsoleCommands() as $command) {
29 10
            $commands[$command->getName()] = $command;
30
        }
31
32 10
        return $commands;
33
    }
34
}
35