Completed
Push — master ( 4b6f0b...499570 )
by Philip
22:53
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
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 UserDeleteCommand extends AbstractUserCommand
10
{
11
    protected function configure()
12
    {
13
        $this
14
            ->setName('gitki:user:delete')
15
            ->setDescription('Deletes an existing user');
16
    }
17
18
    protected function execute(InputInterface $input, OutputInterface $output)
19
    {
20
        $user = $this->selectUser($input, $output);
21
22
        $this->printUser($user, $output);
23
24
        $saveQuestion = new ConfirmationQuestion('Are you sure you want to delete this user? ', false);
25
        if ($this->getQuestionHelper()->ask($input, $output, $saveQuestion)) {
26
            $this->getUserManager()->deleteUser($user);
27
        }
28
    }
29
}
30