ProfilerCompilerPass::process()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 10
nc 2
nop 1
dl 0
loc 14
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
namespace Sitetheory\Bundle\ProfilerStorageBundle\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
8
class ProfilerCompilerPass implements CompilerPassInterface
9
{
10
    /**
11
     * You can modify the container here before it is dumped to PHP code.
12
     *
13
     * @param ContainerBuilder $container
14
     */
15
    public function process(ContainerBuilder $container)
16
    {
17
        $definition = $container->getDefinition('profiler');
18
        // Compatibility for Definitions from Symfony 2.7 to 3.3
19
        if (2 === count($definition->getArguments())) {
20
            $definition->addArgument(true);
21
        }
22
        $definition->addArgument('%sitetheory_profiler_storage.profiler.defaultStorage%');
23
        $definition->addArgument('%sitetheory_profiler_storage.profiler.class%');
24
        $definition->addArgument('%sitetheory_profiler_storage.profiler.dsn%');
25
        $definition->addArgument('%sitetheory_profiler_storage.profiler.username%');
26
        $definition->addArgument('%sitetheory_profiler_storage.profiler.password%');
27
        $definition->addArgument('%sitetheory_profiler_storage.profiler.ttl%');
28
        $definition->setClass('Sitetheory\Bundle\ProfilerStorageBundle\Profiler\Profiler');
29
    }
30
}
31