Code Duplication    Length = 18-22 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-70 (lines=22) @@
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
        $handler = new DeleteUserHandler($repository);
56
57
        $username = $input->getArgument('username');
58
        $user = $repository->findByUsername($username);
59
60
        if (!$user) {
61
            $output->writeln('<error>'.$username.' doesn\'t exists');
62
            exit;
63
        }
64
65
        $command = new DeleteUser($user);
66
67
        $handler->handle($command);
68
69
        $output->writeln($username . ' has been deleted');
70
    }
71
72
    /**
73
     * Get the repository for the user's Class.