Passed
Pull Request — main (#3)
by Chema
02:25
created

ConsoleBootstrap::getDefaultCommands()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

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