private function removePlayerFromSeat(TableSeat $seat, $assignBot = true) { if ($seat->isFree()) { throw new \LogicException('Unable to remove player from empty seat.'); } $this->logger->info('Removing player from seat', ['player' => $seat->getPlayer()->getName(), 'table_id' => $seat->getTable()->getId()]); $player = $seat->getPlayer(); $table = $seat->getTable(); $seat->setPlayer(null); $seat->setInPlay(false); $seat->resetHand(); $player->setSeat(null); $this->broadcastMessageIgnoringPlayer($table, $player, new SocketPlayerLeftTableMessage($seat->getSeatIndex())); if ($table instanceof WebSocketObservableTable) { $table->broadcast(new WebSocketPlayerLeftTableMessage($seat->getSeatIndex())); } if ($assignBot) { $bot = $this->playerFactory->newServerPlayer('Bot' . $seat->getSeatIndex(), $seat, 5000); $this->assignPlayerToSeat($seat, $bot); } }
public function toArray() { return ['seatIndex' => $this->seat->getSeatIndex(), 'player' => ['name' => $this->seat->getPlayer()->getName(), 'money' => $this->seat->getPlayer()->getChips()->getAmount()]]; }