Completed
Pull Request — master (#10)
by
unknown
05:51 queued 02:49
created

CreateUserCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 22
rs 9.2
cc 1
eloc 16
nc 1
nop 0
1
<?php
2
3
namespace SumoCoders\FrameworkMultiUserBundle\Command;
4
5
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6
use Symfony\Component\Console\Input\InputArgument;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
class CreateUserCommand extends ContainerAwareCommand
11
{
12
    protected function configure()
13
    {
14
        $this
15
            ->setName('sumocoders:multiuser:create')
16
            ->setDescription('Create a user entity')
17
            ->addArgument(
18
                'username',
19
                InputArgument::REQUIRED,
20
                'The username of the user'
21
            )
22
            ->addArgument(
23
                'password',
24
                InputArgument::REQUIRED,
25
                'The password for the user'
26
            )
27
            ->addArgument(
28
                'displayName',
29
                InputArgument::REQUIRED,
30
                'The display name for the user'
31
            )
32
        ;
33
    }
34
35 View Code Duplication
    protected function execute(InputInterface $input, OutputInterface $output)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
36
    {
37
        $repository = $this->getContainer()->get('multi_user.user.repository');
38
39
        $handler = new CreateUserHandler($repository);
40
41
        $username = $input->getArgument('username');
42
        $password = $input->getArgument('password');
43
        $displayName = $input->getArgument('displayName');
44
45
        $command = new CreateUser($username, $password, $displayName);
46
47
        $handler->handle($command);
48
49
        $output->writeln($username . ' has been created');
50
    }
51
}
52