@@ -25,7 +25,7 @@ |
||
| 25 | 25 | $this->gameService->em->persist($game); |
| 26 | 26 | $this->gameService->em->flush(); |
| 27 | 27 | $this->botApi->sendMessage($message['chat']['id'], 'The game has started!'); |
| 28 | - $this->gameService->askQuestion($game,$question); |
|
| 28 | + $this->gameService->askQuestion($game, $question); |
|
| 29 | 29 | |
| 30 | 30 | } else { |
| 31 | 31 | $this->botApi->sendMessage($message['chat']['id'], 'The game is already running...'); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | if (!$question) return; |
| 97 | 97 | |
| 98 | - if (mb_strtoupper($question->a1,'UTF-8') == mb_strtoupper($message['text'],'UTF-8')) { |
|
| 98 | + if (mb_strtoupper($question->a1, 'UTF-8') == mb_strtoupper($message['text'], 'UTF-8')) { |
|
| 99 | 99 | // Correct answer! |
| 100 | 100 | $this->botApi->sendMessage($game->chatId, 'Правильно! Следующий вопрос!'); |
| 101 | 101 | $question = $this->getRandomQuestion(); |
@@ -109,14 +109,14 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | } else { |
| 111 | 111 | // Incorrect answer |
| 112 | - $this->botApi->sendMessage($game->chatId, 'Неправильно, @'.$user->getAlias().'. Правильный ответ: *'.$question->a1.'*','markdown'); |
|
| 112 | + $this->botApi->sendMessage($game->chatId, 'Неправильно, @'.$user->getAlias().'. Правильный ответ: *'.$question->a1.'*', 'markdown'); |
|
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | public function askQuestion(Game $game, Question $question) |
| 118 | 118 | { |
| 119 | - $this->botApi->sendMessage($game->chatId, '*[#вопрос]* '.$question->text,'markdown'); |
|
| 119 | + $this->botApi->sendMessage($game->chatId, '*[#вопрос]* '.$question->text, 'markdown'); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | public function getRandomQuestion() |
| 128 | 128 | { |
| 129 | 129 | $count = $this->em->createQueryBuilder() |
| 130 | - ->select('COUNT(u)')->from('AppBundle:Question','u') |
|
| 130 | + ->select('COUNT(u)')->from('AppBundle:Question', 'u') |
|
| 131 | 131 | ->getQuery() |
| 132 | 132 | ->getSingleScalarResult(); |
| 133 | 133 | |
@@ -93,7 +93,9 @@ |
||
| 93 | 93 | /** @var Question $question */ |
| 94 | 94 | $question = $this->em->getRepository('AppBundle:Question')->find($game->lastQuestion); |
| 95 | 95 | |
| 96 | - if (!$question) return; |
|
| 96 | + if (!$question) { |
|
| 97 | + return; |
|
| 98 | + } |
|
| 97 | 99 | |
| 98 | 100 | if (mb_strtoupper($question->a1,'UTF-8') == mb_strtoupper($message['text'],'UTF-8')) { |
| 99 | 101 | // Correct answer! |