Completed
Push — master ( cd591f...5bed62 )
by Yaroslav
08:03 queued 01:41
created

Controller   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 4
dl 0
loc 26
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A securedByIsGrantedAction() 0 3 1
A securedBySecurityAction() 0 3 1
A publicAction() 0 3 1
1
<?php
2
3
/*
4
 *
5
 * (c) Yaroslav Honcharuk <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Yarhon\RouteGuardBundle\Tests\Functional\Bundle\SensioSecurityBundle\Controller;
12
13
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
14
use Symfony\Component\Routing\Annotation\Route;
15
use Symfony\Component\HttpFoundation\Request;
16
use Symfony\Component\HttpFoundation\Response;
17
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
18
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
19
20
/**
21
 * @author Yaroslav Honcharuk <[email protected]>
22
 */
23
class Controller extends AbstractController
24
{
25
    /**
26
     * @Route("/public_action", name="public_action")
27
     */
28
    public function publicAction()
29
    {
30
        return new Response('user action');
31
    }
32
33
    /**
34
     * @Route("/user_action", name="user_action")
35
     * @IsGranted("ROLE_USER", subject="argument")
36
     */
37
    public function securedByIsGrantedAction($argument = 10)
0 ignored issues
show
Unused Code introduced by
The parameter $argument is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

37
    public function securedByIsGrantedAction(/** @scrutinizer ignore-unused */ $argument = 10)

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

Loading history...
38
    {
39
        return new Response('user action');
40
    }
41
42
    /**
43
     * @Route("/admin_action", name="admin_action")
44
     * @Security("is_granted('ROLE_ADMIN')")
45
     */
46
    public function securedBySecurityAction($argument)
0 ignored issues
show
Unused Code introduced by
The parameter $argument is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

46
    public function securedBySecurityAction(/** @scrutinizer ignore-unused */ $argument)

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

Loading history...
47
    {
48
        return new Response('admin action');
49
    }
50
}
51