/** * @param PlayerRegistration|Message $message * * @throws PlayerIdNotValidException * @throws PlayerNameNotValidException * @throws PlayerAlreadyExistsException * * @return void */ public function handle(Message $message) { $id = new PlayerId($message->id()); $name = new PlayerName($message->name()); $this->registrar->__invoke($id, $name); }
/** * @param PlayerRegistered|Message $message * * @throws AccountOwnerNotValidException * @throws AccountOwnerAlreadyHasAnAccountException * * @return void */ public function notify(Message $message) { $owner = new AccountOwner($message->aggregateId()); $this->opener->__invoke($owner); }