SymfonyAccessControlResolver::supports()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
cc 1
nc 1
nop 1
crap 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