/** * Deals the cards evenly between the two players * * @param Player $player1 * @param Player $player2 */ public function deal(Player $player1, Player $player2) { $players = collect([$player1, $player2]); while ($this->deck->hasCards()) { $dealTo = $players->shift(); $dealTo->acceptCard($this->deck->shift()); $players->push($dealTo); } }