/**
  * @return array
  */
 public function toArray()
 {
     return ['seatIndex' => $this->player->getSeat()->getSeatIndex(), 'hands' => $this->player->getSeat()->getHands()->map(function (HandBetPair $hand) {
         return ['hand' => ['value' => $hand->getHand()->getValue(), 'cards' => $hand->getHand()->getCards()->map(function (Card $card) {
             return ['rank' => $card->getRank(), 'suit' => $card->getSuit()];
         })->elements()], 'bet' => $hand->getBet()];
     })->elements()];
 }
 public function toArray()
 {
     return ['dealerCard' => $this->serializeCard($this->dealerHand->getFaceUpCard()), 'playerHand' => $this->serializeHand($this->playerHand), 'money' => $this->player->getChips()->getAmount()];
 }
 public function toArray()
 {
     return ['minimumBet' => $this->minimumBet, 'maximumBet' => $this->maximumBet, 'money' => $this->player->getChips()->getAmount()];
 }
 private function serializePlayer(Player $player = null)
 {
     return ['name' => $player->getName(), 'money' => $player->getChips()->getAmount()];
 }
 public function toArray()
 {
     return ['seatIndex' => $this->player->getSeat()->getSeatIndex(), 'name' => $this->player->getName()];
 }
Exemple #6
0
 public function ensurePlayerActive(Player $player, $value = null)
 {
     if ($player->getSeat() === null || $player->getTable() !== $this) {
         return \React\Promise\reject(new \RuntimeException('Player left table'));
     }
     return \React\Promise\resolve($value);
 }
 private function assignPlayerToSeat(TableSeat $seat, Player $player)
 {
     if (!$seat->isFree()) {
         throw new \LogicException('Player can only be assigned to an empty or bot seat.');
     }
     $this->logger->info('Assigning player to seat', ['player' => $player->getName(), 'table_id' => $seat->getTable()->getId()]);
     $seat->setPlayer($player);
     $seat->setInPlay(false);
     $seat->resetHand();
     $player->setSeat($seat);
     $table = $seat->getTable();
     $this->broadcastMessageIgnoringPlayer($table, $player, new SocketPlayerJoinedTableMessage($seat));
     if ($table instanceof WebSocketObservableTable) {
         $table->broadcast(new WebSocketPlayerJoinedTableMessage($seat));
         $table->broadcast(new WebSocketSendStateMessage($table));
     }
 }
 /**
  * @return array
  */
 public function toArray()
 {
     return ['seatIndex' => $this->player->getSeat()->getSeatIndex(), 'handIndex' => $this->findHandIndex(), 'card' => $this->serializeCard()];
 }
 public function __construct($name, $seat, $chips, $socketConnection, $connectionManager)
 {
     parent::__construct($name, $seat, $chips);
     $this->connection = new Connection($this, $socketConnection, $connectionManager);
 }
 /**
  * @return array
  */
 public function toArray()
 {
     return ['seatIndex' => $this->player->getSeat()->getSeatIndex(), 'handIndex' => $this->findHandIndex(), 'result' => $this->getResult()];
 }
 /**
  * @return array
  */
 public function toArray()
 {
     return ['seatIndex' => $this->player->getSeat()->getSeatIndex(), 'betAmount' => $this->betAmount, 'money' => $this->player->getChips()->getAmount()];
 }
 public function __construct($name, $seat, $chips, ConnectionManager $connectionManager)
 {
     parent::__construct($name, $seat, $chips);
     $this->connectionManager = $connectionManager;
 }