Code Duplication    Length = 18-21 lines in 2 locations

Command/CreateUserCommand.php 1 location

@@ 59-76 (lines=18) @@
56
        ;
57
    }
58
59
    protected function execute(InputInterface $input, OutputInterface $output)
60
    {
61
        $userClass = $input->getOption('class');
62
63
        $repository = $this->getRepository($userClass);
64
65
        $handler = new CreateUserHandler($repository);
66
67
        $username = $input->getArgument('username');
68
        $password = $input->getArgument('password');
69
        $displayName = $input->getArgument('displayName');
70
71
        $command = new CreateUser($username, $password, $displayName);
72
73
        $handler->handle($command);
74
75
        $output->writeln($username . ' has been created');
76
    }
77
78
    /**
79
     * Get the repository for the user's Class.

Command/DeleteUserCommand.php 1 location

@@ 49-69 (lines=21) @@
46
        ;
47
    }
48
49
    protected function execute(InputInterface $input, OutputInterface $output)
50
    {
51
        $userClass = $input->getOption('class');
52
53
        $repository = $this->getRepository($userClass);
54
        
55
        $username = $input->getArgument('username');
56
        $user = $repository->findByUsername($username);
57
58
        if (!$user) {
59
            $output->writeln('<error>'.$username.' doesn\'t exists');
60
            return;
61
        }
62
63
        $command = new DeleteUser($user);
64
        
65
        $handler = new DeleteUserHandler($repository);
66
        $handler->handle($command);
67
68
        $output->writeln($username . ' has been deleted');
69
    }
70
71
    /**
72
     * Get the repository for the user's Class.