| Conditions | 3 |
| Paths | 2 |
| Total Lines | 23 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | public function indexAction() |
||
| 14 | { |
||
| 15 | // Initialize |
||
| 16 | $wsConfig = $this->container->getParameter('afsy_chat.websocket'); |
||
| 17 | $itsChristmas = false; |
||
| 18 | $xmasLink = ''; |
||
| 19 | |||
| 20 | // Check if it's Christmas Time |
||
| 21 | // Only on december and before the 26th |
||
| 22 | if ('12' === date('m') && (int) date('d') < 26) { |
||
| 23 | // Set Christmas |
||
| 24 | $itsChristmas = true; |
||
| 25 | |||
| 26 | // Get Christmas link |
||
| 27 | $christmasLinks = $this->container->getParameter('xmas_links'); |
||
| 28 | $xmasLink = $christmasLinks[rand(0, \count($christmasLinks) - 1)]; |
||
| 29 | } |
||
| 30 | |||
| 31 | // Render template |
||
| 32 | return $this->render('default/index.html.twig', [ |
||
| 33 | 'ws_url' => $wsConfig['host'].':'.$wsConfig['port'], |
||
| 34 | 'its_christmas' => $itsChristmas, |
||
| 35 | 'xmas_link' => $xmasLink, |
||
| 36 | ]); |
||
| 39 |