DefaultController   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A indexAction() 0 14 1
1
<?php
2
3
/**
4
 * Copyright (c) 2016 Francois-Xavier Soubirou.
5
 *
6
 * This file is part of eco4.
7
 *
8
 * eco4 is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU General Public License as published by
10
 * the Free Software Foundation, either version 3 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * eco4 is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with eco4. If not, see <http://www.gnu.org/licenses/>.
20
 */
21
declare(strict_types=1);
22
23
namespace AppBundle\Controller;
24
25
use AppBundle\Entity\ObjectType;
26
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
27
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
28
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
29
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
30
31
/**
32
 * Default controller class.
33
 *
34
 * @category  Eco4 App
35
 *
36
 * @author    Francois-Xavier Soubirou <[email protected]>
37
 * @copyright 2016 Francois-Xavier Soubirou
38
 * @license   http://www.gnu.org/licenses/   GPLv3
39
 *
40
 * @link      https://www.eco4.io
41
 */
42
class DefaultController extends Controller
43
{
44
    /**
45
     * Default route.
46
     *
47
     * @return Response A Response instance
48
     *
49
     * @Route("/home", name="homepage")
50
     * @Security("has_role('ROLE_USER')")
51
     * @Method("GET")
52
     */
53
    public function indexAction()
54
    {
55
        $user = $this->getUser();
56
57
        $engine = $this->get('app.engine');
58
        $engine->refresh($user, ObjectType::MINE);
59
60
        $mine = $user->getMine();
61
62
        return $this->render(
63
            'default/index.html.twig',
64
            ['mine' => $mine]
65
        );
66
    }
67
}
68