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

UserDeleteCommand::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 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