Passed
Push — master ( 53136f...ce1219 )
by Thomas
16:59 queued 07:11
created

SymfonyTestController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A indexAction() 0 11 1
A forcedLoginAction() 0 14 1
1
<?php
2
3
namespace AppBundle\Controller;
4
5
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6
use Symfony\Component\HttpFoundation\Request;
7
8
class SymfonyTestController extends AbstractController
9
{
10
    /**
11
     * @Route("/symfony-test/", name="symfony-test")
12
     *
13
     *
14
     * @param \Symfony\Component\HttpFoundation\Request $request
15
     *
16
     * @return \Symfony\Component\HttpFoundation\Response
17
     */
18
    public function indexAction(Request $request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
19
    {
20
        $user = $this->getUser();
21
22
        $this->setMenu(MNU_CACHES_SEARCH);
23
        $this->setTitle('Symfony Controlled');
24
25
        return $this->render('default/index.html.twig', [
26
            'user' => $user
27
        ]);
28
    }
29
30
    /**
31
     * @Route("/symfony-test/forced-login/", name="symfony-test.forced-login")
32
     *
33
     *
34
     * @param \Symfony\Component\HttpFoundation\Request $request
35
     *
36
     * @return \Symfony\Component\HttpFoundation\Response
37
     */
38
    public function forcedLoginAction(Request $request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
39
    {
40
        $this->denyAccessUnlessGranted('ROLE_USER', null, 'Unable to access this page!');
41
42
        $user = $this->getUser();
43
        dump($user->getRoles());
44
45
        $this->setMenu(MNU_CACHES_SEARCH);
46
        $this->setTitle('Symfony Controlled');
47
48
        return $this->render('default/index.html.twig', [
49
            'user' => $user
50
        ]);
51
    }
52
}
53