Passed
Push — feature/create-console-bootstr... ( abaeda )
by Chema
04:15
created

ConsoleBootstrap   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

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
    protected function getDefaultCommands(): array
25
    {
26
        $commands = parent::getDefaultCommands();
27
28
        foreach ($this->getFactory()->getConsoleCommands() as $command) {
29
            $commands[$command->getName()] = $command;
30
        }
31
32
        return $commands;
33
    }
34
}
35