Completed
Push — master ( 4b6f0b...499570 )
by Philip
22:53
created

UserAddCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace App\Command;
4
5
use Symfony\Component\Console\Input\InputInterface;
6
use Symfony\Component\Console\Output\OutputInterface;
7
use Symfony\Component\Console\Question\ConfirmationQuestion;
8
9
class UserAddCommand extends AbstractUserCommand
10
{
11
    protected function configure()
12
    {
13
        $this
14
            ->setName('gitki:user:add')
15
            ->setDescription('Add a new user');
16
    }
17
18
    protected function execute(InputInterface $input, OutputInterface $output)
19
    {
20
        $questionHelper = $this->getQuestionHelper();
21
        $userManager = $this->getUserManager();
22
23
        $user = $this->createUser($input, $output);
24
25
        $this->printUser($user, $output);
26
27
        $createQuestion = new ConfirmationQuestion('Create this user? ', false);
28
        if ($questionHelper->ask($input, $output, $createQuestion)) {
29
            $userManager->updateUser($user);
30
        }
31
    }
32
}
33