Completed
Pull Request — master (#4)
by Adrien
02:50
created

DebugToolbarCompilerPass   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 14
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 8 2
1
<?php
2
3
namespace Chris\Bundle\FrontRenderBundle\DependencyInjection\CompilerPass;
4
5
use Chris\Bundle\FrontRenderBundle\Subscriber\WebDebugToolbarListener;
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Reference;
9
10
class DebugToolbarCompilerPass implements CompilerPassInterface
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function process(ContainerBuilder $container)
16
    {
17
        if ($container->has('web_profiler.debug_toolbar')) {
18
            $container->setParameter('web_profiler.debug_toolbar.class', WebDebugToolbarListener::class);
19
            $debugToolbarDefinition = $container->getDefinition('web_profiler.debug_toolbar');
20
            $debugToolbarDefinition->addArgument(new Reference('front_render_bundle.twig_lexer_manager'));
21
        }
22
    }
23
}
24