UserAddCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 13
c 1
b 0
f 0
dl 0
loc 25
ccs 17
cts 17
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 1
A execute() 0 5 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\Cli\Wizard\UserCreationWizardInterface;
11
12
final class UserAddCommand extends Command
13
{
14 1
    public function __construct(
15
        private readonly ContainerInterface $dic
16
    ) {
17 1
        parent::__construct(
18 1
            'user:add',
19 1
            'Adds a user'
20 1
        );
21
22 1
        $this
23 1
            ->argument(
24 1
                '<username>',
25 1
                'User name'
26 1
            )
27 1
            ->usage(
28 1
                '<bold>  $0 ua some-username</end> <comment></end> ## Adds user with name `some-username`<eol/>'
29 1
            );
30
    }
31
32 1
    public function execute(?string $username): void
33
    {
34 1
        $this->dic->get(UserCreationWizardInterface::class)->create(
35 1
            new Interactor(),
36 1
            (string) $username
37 1
        );
38
    }
39
}
40