Completed
Push — master ( dfad4d...8cf454 )
by Philip
21:24
created

UserDeleteCommand::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 2
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 UserDeleteCommand extends AbstractUserCommand
11
{
12
    protected function configure()
13
    {
14
        $this
15
            ->setName('gitki:user:delete')
16
            ->setDescription('Deletes an existing user');
17
    }
18
19
    protected function execute(InputInterface $input, OutputInterface $output)
20
    {
21
        $user = $this->selectUser($input, $output);
22
23
        $this->printUser($user, $output);
24
25
        $saveQuestion = new ConfirmationQuestion('Are you sure you want to delete this user? ', false);
26
        if ($this->getQuestionHelper()->ask($input, $output, $saveQuestion)) {
27
            $this->getUserManager()->deleteUser($user);
28
        }
29
    }
30
}
31