Completed
Push — master ( e52edd...222be8 )
by Nikola
04:48
created

TwigExtensionsCompilerPass   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 2
dl 0
loc 20
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B process() 0 14 5
1
<?php
2
/*
3
 * This file is part of the QueryResourcesLoaderBundle, an RunOpenCode project.
4
 *
5
 * (c) 2017 RunOpenCode.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace RunOpenCode\Bundle\QueryResourcesLoader\DependencyInjection\CompilerPass;
11
12
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
13
use Symfony\Component\DependencyInjection\ContainerBuilder;
14
15
/**
16
 * Class TwigExtensionsCompilerPass
17
 *
18
 * Prepares Twig extensions.
19
 *
20
 * @package RunOpenCode\Bundle\QueryResourcesLoader\DependencyInjection\CompilerPass
21
 */
22
class TwigExtensionsCompilerPass implements CompilerPassInterface
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27 4
    public function process(ContainerBuilder $container)
28
    {
29 4
        if (!$container->hasParameter('kernel.debug') || !$container->getParameter('kernel.debug')) {
30 2
            return;
31
        }
32
33 2
        if ($container->hasDefinition('twig.extension.profiler')) {
34 1
            $container->getDefinition('twig.extension.profiler')->addTag('run_open_code.query_resources_loader.twig.extension');
35
        }
36
37 2
        if ($container->hasDefinition('twig.extension.debug')) {
38 1
            $container->getDefinition('twig.extension.debug')->addTag('run_open_code.query_resources_loader.twig.extension');
39
        }
40 2
    }
41
}
42