/** * @param Command|RegisterUser $command */ public function handle(Command $command) { $user = call_user_func([$this->userClass, 'register'], $command->getUsername(), $command->getEmail(), $command->getPassword(), $this->encoder); $this->userRepository->add($user); }