/** * @param PgnGame $pgnGame * @return string */ private function getTitle(PgnGame $pgnGame) : string { $chessGameService = new ChessGameService(); $chessGameService->_parseFen($pgnGame->getFen()); switch ($chessGameService->toMove()) { case 'B': $text = 'Ход черных. '; break; default: $text = 'Ход белых. '; } switch ($pgnGame->getResult()) { case '1-0': $text .= "Белые выигрывают"; break; case '1/2-1/2': $text .= "Ничья"; break; case '0-1': $text .= "Черные выигрывают"; break; } return $text; }
/** * @param Game $game * @return bool */ public function canAbort(Game $game) : bool { $this->chessGameService->setPgn($game->getPgn()); return count($this->chessGameService->getMoveList()) < 3; }