Completed
Push — master ( af3254...7bde89 )
by Tobias
10:59
created

SymfonyProfilerPass::process()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3.0261

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
ccs 6
cts 7
cp 0.8571
rs 9.4285
cc 3
eloc 5
nc 3
nop 1
crap 3.0261
1
<?php
2
3
/*
4
 * This file is part of the PHP Translation package.
5
 *
6
 * (c) PHP Translation team <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Translation\Bundle\DependencyInjection\CompilerPass;
13
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\Definition;
17
18
/**
19
 * Make sure we have all the dependencies for Symfony Profiler.
20
 *
21
 * @author Tobias Nyholm <[email protected]>
22
 */
23
class SymfonyProfilerPass implements CompilerPassInterface
24
{
25 4
    public function process(ContainerBuilder $container)
26
    {
27
        /* @var Definition $def */
28 4
        if (!$container->hasDefinition('php_translation.data_collector')) {
29
            return;
30
        }
31
32 4
        if (!$container->hasDefinition('translator.data_collector')) {
33
            // No Symfony translation data collector was found. We cannot use our collection without it.
34 4
            $container->removeDefinition('php_translation.data_collector');
35 4
        }
36 4
    }
37
}
38