ListCrates::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
/**
3
 * This file is part of the daikon-cqrs/boot project.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Daikon\Boot\Console\Command;
10
11
use Daikon\Boot\Crate\CrateMap;
12
use Symfony\Component\Console\Command\Command;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Command\Command was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use Symfony\Component\Console\Input\InputInterface;
14
use Symfony\Component\Console\Output\OutputInterface;
15
16
final class ListCrates extends Command
17
{
18
    private CrateMap $crateMap;
19
20
    public function __construct(CrateMap $crateMap)
21
    {
22
        $this->crateMap = $crateMap;
23
24
        parent::__construct();
25
    }
26
27
    protected function configure(): void
28
    {
29
        $this
30
            ->setName('crate:ls')
31
            ->setDescription('Lists currently installed crates.');
32
    }
33
34
    protected function execute(InputInterface $input, OutputInterface $output): int
35
    {
36
        foreach ($this->crateMap as $crateKey => $crate) {
37
            $output->writeln(sprintf('Summary for crate <options=bold>%s</>', $crateKey));
38
            $output->writeln('  Location: '.$crate->getLocation());
39
        }
40
41
        return 0;
42
    }
43
}
44