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

SymfonyProfilerPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 85.71%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 15
ccs 6
cts 7
cp 0.8571
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 12 3
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