/** * @param DrawCard $command * @return Card */ public function handle(DrawCard $command) { $deck = $this->decks->findById($command->getId()); $card = $deck->drawCard(); $this->decks->add($deck); return $card; }
/** * @param ShuffleDeck $command */ public function handle(ShuffleDeck $command) { $deck = $this->decks->findById($command->getId()); $deck->shuffle(); $this->decks->add($deck); }
/** * @param CreateDeck $command */ public function handle(CreateDeck $command) { $id = $command->getId(); $deck = Deck::standard($id); $this->decks->add($deck); }