| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | public function findGame(array $message) |
||
| 35 | { |
||
| 36 | $game = $this->entityManager->getRepository('AppBundle:Game')->findOneBy(['chatId'=>$message['chat']['id']]); |
||
| 37 | if (!$game) { |
||
| 38 | // create game |
||
| 39 | $game = new Game(); |
||
| 40 | $game->status = 0; |
||
| 41 | $game->chatId = $message['chat']['id']; |
||
| 42 | $game->title = isset($message['chat']['title']) |
||
| 43 | ? $message['chat']['title'] |
||
| 44 | : 'No title'; |
||
| 45 | |||
| 46 | $this->entityManager->persist($game); |
||
| 47 | $this->entityManager->flush(); |
||
| 48 | } |
||
| 49 | return $game; |
||
| 50 | } |
||
| 51 | } |
||
| 52 |