Completed
Push — master ( dfad4d...8cf454 )
by Philip
21:24
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
4
namespace Dontdrinkandroot\Gitki\WebBundle\Command;
5
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
use Symfony\Component\Console\Question\ConfirmationQuestion;
9
10
class UserAddCommand extends AbstractUserCommand
11
{
12
    protected function configure()
13
    {
14
        $this
15
            ->setName('gitki:user:add')
16
            ->setDescription('Add a new user');
17
    }
18
19
    protected function execute(InputInterface $input, OutputInterface $output)
20
    {
21
        $questionHelper = $this->getQuestionHelper();
22
        $userManager = $this->getUserManager();
23
24
        $user = $this->createUser($input, $output);
25
26
        $this->printUser($user, $output);
27
28
        $createQuestion = new ConfirmationQuestion('Create this user? ', false);
29
        if ($questionHelper->ask($input, $output, $createQuestion)) {
30
            $userManager->updateUser($user);
31
        }
32
    }
33
}
34