Open micahstairs opened 1 year ago
I'd love a Players class with constants like ALL, OPPONENTS, OTHERS, etc.
It would allow us to simplify code like:
$cards = []; foreach (self::getPlayerIds() as $playerId) { $cards = array_merge($cards, self::getCards(Locations::SCORE, $playerId)); }
to
$cards = self::getCards(Locations::SCORE, Players::ALL);
It would also help us clean up code like:
if ($owner == -2) { // any player $owner_condition = "owner != 0 AND"; } else if ($owner == -3) { // any opponent $opponent_ids = self::getActiveOpponentIds(self::getActivePlayerId()); $owner_condition = self::format("owner IN ({owners}) AND", array('owners' => join(',', $opponent_ids))); } else if ($owner == -4) { // any other player $owner_condition = self::format("owner != 0 AND owner != {player_id} AND", array('player_id' => self::getActivePlayerId())); } else { $owner_condition = self::format("owner = {owner} AND", array('owner' => $owner)); }
I'd love a Players class with constants like ALL, OPPONENTS, OTHERS, etc.
It would allow us to simplify code like:
to
It would also help us clean up code like: