DefaultController   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 2
dl 0
loc 29
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A indexAction() 0 17 1
1
<?php
2
/**
3
 * Buktopuha - Telegram bot for russian trivia game
4
 *
5
 * PHP Version 5
6
 *
7
 * @category Symfony
8
 * @package  Chrl_Buktopuha
9
 * @author   Kirill Kholodilin <[email protected]>
10
 * @license  http://www.gnu.org/copyleft/gpl.html GNU General Public License
11
 * @link     https://take2.ru/
12
 */
13
namespace Chrl\AppBundle\Controller;
14
15
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
16
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
17
use Symfony\Component\HttpFoundation\Request;
18
19
/**
20
 * Default route controller - shows homepage and status
21
 *
22
 * @category Symfony
23
 * @package  Chrl_Buktopuha
24
 * @author   Kirill Kholodilin <[email protected]>
25
 * @license  http://www.gnu.org/copyleft/gpl.html GNU General Public License
26
 * @link     https://take2.ru/
27
 */
28
class DefaultController extends Controller
29
{
30
    /**
31
     * Index action -- homepage
32
     *
33
     * @param Request $request Request object of the webapp
34
     *
35
     * @Route("/", name="homepage", methods={"get"})
36
     *
37
     * @return \Symfony\Component\HttpFoundation\Response
38
     */
39
    public function indexAction(Request $request)
40
    {
41
42
        $activeGames = $this->get('app.gameservice')->getActiveGames();
43
        $inactiveGames = $this->get('app.gameservice')->getInactiveGames();
44
45
        // replace this example code with whatever you need
46
        return $this->render(
47
            'default/index.html.twig',
48
            [
49
                'base_dir' => basename(realpath($this->getParameter('kernel.root_dir').'/..')),
50
                'has_session' => $request->hasSession(),
51
                'activeGames'=>$activeGames,
52
                'inactiveGames'=>$inactiveGames
53
            ]
54
        );
55
    }
56
}
57