/** * Handle the command * * @param $command * @return mixed */ public function handle($command) { $user = User::register($command->username, $command->email, $command->password); $this->repository->save($user); $this->dispatchEventsFor($user); return $user; }
public function handle(UserRepository $repository) { $username = $this->username; $email = $this->email; $password = $this->password; $user = User::register($username, $email, $password); $repository->save($user); return $user; }