CatalogUpdateCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 14
c 1
b 0
f 0
dl 0
loc 28
ccs 19
cts 19
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 1
A execute() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Uxmp\Core\Component\Cli;
6
7
use Ahc\Cli\Input\Command;
8
use Ahc\Cli\IO\Interactor;
9
use Psr\Container\ContainerInterface;
10
use Uxmp\Core\Component\Catalog\Manage\CatalogUpdaterInterface;
11
use Uxmp\Core\Component\Event\EventHandlerInterface;
12
13
final class CatalogUpdateCommand extends Command
14
{
15 1
    public function __construct(
16
        private readonly ContainerInterface $dic
17
    ) {
18 1
        parent::__construct(
19 1
            'catalog:update',
20 1
            'Updates the catalog'
21 1
        );
22
23 1
        $this
24 1
            ->argument(
25 1
                '<catalogId>',
26 1
                'Id of the catalog'
27 1
            )
28 1
            ->usage(
29 1
                '<bold>  $0 cu 666</end> <comment></end> ## Update the catalog with id `666`<eol/>'
30 1
            );
31
    }
32
33 1
    public function execute(?int $catalogId): void
34
    {
35 1
        $this->dic->get(CatalogUpdaterInterface::class)->update(
36 1
            new Interactor(),
37 1
            (int) $catalogId
38 1
        );
39
40 1
        $this->dic->get(EventHandlerInterface::class)->run();
41
    }
42
}
43