Completed
Push — master ( a4bf69...fd2f49 )
by Yaroslav
09:49
created

SensioSecurityExpressionVoterPass::process()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 3
nc 2
nop 1
crap 3
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\DependencyInjection\Compiler;
12
13
use Symfony\Component\DependencyInjection\ContainerBuilder;
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Yarhon\RouteGuardBundle\Security\Authorization\SensioSecurityExpressionVoter;
16
17
/**
18
 * @author Yaroslav Honcharuk <[email protected]>
19
 */
20
class SensioSecurityExpressionVoterPass implements CompilerPassInterface
21
{
22
    /**
23
     * @see https://github.com/sensiolabs/SensioFrameworkExtraBundle/blob/v5.1.0/Resources/config/security.xml
24
     *
25
     * {@inheritdoc}
26
     */
27 3
    public function process(ContainerBuilder $container)
28
    {
29 3
        if (!$container->hasDefinition('sensio_framework_extra.security.listener') ||
30 3
            !$container->hasDefinition('sensio_framework_extra.security.expression_language.default')) {
31
32 1
            $container->removeDefinition(SensioSecurityExpressionVoter::class);
33
        }
34 3
    }
35
}
36