SensioFrameworkExtraBundlePass::process()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
ccs 5
cts 5
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\TestProvider\SensioExtraProvider;
16
use Yarhon\RouteGuardBundle\Security\TestResolver\SensioExtraResolver;
17
18
/**
19
 * @author Yaroslav Honcharuk <[email protected]>
20
 */
21
class SensioFrameworkExtraBundlePass implements CompilerPassInterface
22
{
23
    /**
24
     * @see https://github.com/sensiolabs/SensioFrameworkExtraBundle/blob/v5.1.0/Resources/config/security.xml
25
     *
26
     * {@inheritdoc}
27
     */
28 21
    public function process(ContainerBuilder $container)
29
    {
30 21
        if (!$container->hasDefinition('sensio_framework_extra.security.listener') &&
31 10
            !$container->hasDefinition('framework_extra_bundle.event.is_granted')) {
32 9
            $container->removeDefinition(SensioExtraProvider::class);
33 9
            $container->removeDefinition(SensioExtraResolver::class);
34
        }
35 21
    }
36
}
37