CleanTemplatingPass::process()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 12
cts 12
cp 1
rs 9.7333
c 0
b 0
f 0
cc 3
nc 4
nop 1
crap 3
1
<?php
2
3
/*
4
 * This file is part of the Ivory Google Map bundle package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ivory\GoogleMapBundle\DependencyInjection\Compiler;
13
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
17
/**
18
 * @author GeLo <[email protected]>
19
 */
20
class CleanTemplatingPass implements CompilerPassInterface
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25 57
    public function process(ContainerBuilder $container)
26
    {
27 57
        if (!$container->hasDefinition('templating.engine.php')) {
28 56
            $container->removeDefinition('ivory.google_map.templating.api');
29 56
            $container->removeDefinition('ivory.google_map.templating.map');
30 56
            $container->removeDefinition('ivory.google_map.templating.map.static');
31 56
            $container->removeDefinition('ivory.google_map.templating.place_autocomplete');
32
        }
33
34 57
        if (!$container->hasDefinition('twig')) {
35 56
            $container->removeDefinition('ivory.google_map.twig.extension.api');
36 56
            $container->removeDefinition('ivory.google_map.twig.extension.map');
37 56
            $container->removeDefinition('ivory.google_map.twig.extension.map.static');
38 56
            $container->removeDefinition('ivory.google_map.twig.extension.place_autocomplete');
39
        }
40 57
    }
41
}
42