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

TwigExtensionsCompilerPass::process()   B

Complexity

Conditions 5
Paths 5

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 5

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 8
cts 8
cp 1
rs 8.8571
c 0
b 0
f 0
cc 5
eloc 7
nc 5
nop 1
crap 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