ProfilerPass   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 28
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 25 2
1
<?php
2
3
namespace PommProject\PommBundle\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection as DI;
6
7
class ProfilerPass implements DI\Compiler\CompilerPassInterface
8
{
9
    public function process(DI\ContainerBuilder $container)
10
    {
11
        if ($container->hasDefinition('profiler') === false) {
12
            return;
13
        }
14
15
        $definition = new DI\Definition("PommProject\\SymfonyBridge\\Controller\\PommProfilerController", [
16
            new DI\Reference('router'),
17
            new DI\Reference('profiler'),
18
            new DI\Reference('twig'),
19
            new DI\Reference('pomm')
20
        ]);
21
        $definition->setPublic(true);
22
        $container->setDefinition('pomm.controller.profiler', $definition);
23
24
        $definition = new DI\Definition(
25
            "PommProject\\PommBundle\\Twig\\Extension\\ProfilerExtension",
26
            [new DI\Reference('twig.loader.filesystem')]
27
        );
28
        //we run after the twig tags are collected so we need to manually do what twig compiler pass does
29
        $twig = $container->getDefinition('twig');
30
        $twig->addMethodCall('addExtension', [new DI\Reference('pomm.twig_extension')]);
31
32
        $container->setDefinition('pomm.twig_extension', $definition);
33
    }
34
}
35