Passed
Push — master ( b31bae...4a6c69 )
by Jesús
01:27 queued 13s
created

ConsoleBootstrap   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
c 1
b 0
f 0
dl 0
loc 18
rs 10
ccs 5
cts 5
cp 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getDefaultCommands() 0 9 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