SymfonyAccessControlResolver   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 5
dl 0
loc 31
rs 10
c 0
b 0
f 0
ccs 7
cts 7
cp 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A supports() 0 3 1
A resolve() 0 5 1
A __construct() 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\Security\TestResolver;
12
13
use Symfony\Component\HttpFoundation\RequestStack;
14
use Yarhon\RouteGuardBundle\Security\Test\TestInterface;
15
use Yarhon\RouteGuardBundle\Security\Test\SymfonyAccessControlTest;
16
use Yarhon\RouteGuardBundle\Routing\RouteContextInterface;
17
18
/**
19
 * @author Yaroslav Honcharuk <[email protected]>
20
 */
21
class SymfonyAccessControlResolver implements SymfonySecurityResolverInterface
22
{
23
    /**
24
     * @var RequestStack
25
     */
26
    private $requestStack;
27
28
    /**
29
     * @param RequestStack $requestStack
30
     */
31 10
    public function __construct(RequestStack $requestStack)
32
    {
33 10
        $this->requestStack = $requestStack;
34 10
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39 6
    public function supports(TestInterface $test)
40
    {
41 6
        return $test instanceof SymfonyAccessControlTest;
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47 6
    public function resolve(TestInterface $test, RouteContextInterface $routeContext)
48
    {
49
        /* @var SymfonyAccessControlTest $test */
50
51 6
        return [$test->getAttributes(), $this->requestStack->getCurrentRequest()];
52
    }
53
}
54