Ejemplo n.º 1
0
 /**
  * @param GameInterface $game
  * @param string        $class
  *
  * @return PersistableGameInterface
  */
 protected function createPersistable(GameInterface $game, $class)
 {
     $persistable = $this->createPersistableGameObject($class);
     $persistable->setUid($game->getId());
     $persistable->setWhitePlayerName($game->getWhitePlayer()->getName());
     $persistable->setWhitePlayerHuman($game->getWhitePlayer()->isHuman());
     $persistable->setBlackPlayerName($game->getBlackPlayer()->getName());
     $persistable->setBlackPlayerHuman($game->getBlackPlayer()->isHuman());
     $persistable->setFinished($game->hasFinished());
     $persistable->setFinishedReason($game->getFinishedReason());
     return $persistable;
 }
Ejemplo n.º 2
0
 /**
  * @param GameInterface $game
  *
  * @return array
  */
 private function getExpectedGameArray(GameInterface $game)
 {
     return ['uid' => $game->getId(), 'white_player' => $this->getExpectedPlayerArray($game->getWhitePlayer()), 'black_player' => $this->getExpectedPlayerArray($game->getBlackPlayer()), 'finished' => $game->hasFinished(), 'finished_reason' => $game->getFinishedReason(), 'board' => $this->getExpectedBoardArray($game->getBoard()), 'current_color' => $game->getCurrentColor(), 'states' => $this->getExpectedGameStatesArray($game->getStates()->toArray())];
 }