/** * @param RegisterUserCommand $command * * @return User */ protected function handleRegisterUser(RegisterUserCommand $command) { $username = new Username($command->username()); $password = new Password($command->password()); $user = $this->registerUserService->registerUser($username, $password); $this->userRepository->add($user); return $user; }