IndexController   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 4
eloc 6
c 2
b 0
f 1
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getIndexBreadcrumbs() 0 3 1
A indexAction() 0 8 3
1
<?php
2
3
/*
4
 * This file is part of the vseth-semesterly-reports project.
5
 *
6
 * (c) Florian Moser <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace App\Controller;
13
14
use App\Controller\Base\BaseDoctrineController;
15
use Symfony\Component\Routing\Annotation\Route;
16
use Symfony\Component\Security\Core\Security;
17
18
/**
19
 * @Route("/")
20
 */
21
class IndexController extends BaseDoctrineController
22
{
23
    /**
24
     * @Route("", name="index")
25
     *
26
     * @return \Symfony\Component\HttpFoundation\Response
27
     */
28
    public function indexAction(Security $security)
29
    {
30
        $user = $security->getUser();
31
        if ($user !== null && \in_array('ROLE_ADMIN', $user->getRoles(), true)) {
32
            return $this->redirectToRoute('administration');
33
        }
34
35
        return $this->render('index/index.html.twig');
36
    }
37
38
    /**
39
     * no breadcrumbs on the index.
40
     *
41
     * @return \App\Model\Breadcrumb[]|array
42
     */
43
    protected function getIndexBreadcrumbs()
44
    {
45
        return [];
46
    }
47
}
48