public function castRoles() { $roles = Ginq::from($this->shuffleRoles())->take($this->room->getPlayers()->count())->toList(); $pairs = array_map(null, $roles, $this->room->getPlayers()->getValues()); foreach ($pairs as list($role, $player)) { $gamePlayer = new GamePlayer($this, $player); $gamePlayer->setRole($role); } }
/** * @JMS\VirtualProperty * @JMS\SerializedName("swapDestination") * @JMS\Groups({"finished"}) * * @return array */ public function getSwapDestinationsSummary() { return is_null($this->swapDestination) ? null : $this->swapDestination->getPlayer(); }