Completed
Push — master ( 3a24c5...edf7f7 )
by Tobias
45:53 queued 33:09
created

SymfonyProfilerPass::process()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 4.125

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 3
cts 6
cp 0.5
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 5
nc 3
nop 1
crap 4.125
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 1
    public function process(ContainerBuilder $container)
26
    {
27
        /* @var Definition $def */
28 1
        if (!$container->hasDefinition('php_translation.data_collector')) {
29 1
            return;
30
        }
31
32
        if (!$container->hasDefinition('translator.data_collector')) {
33
            throw new \LogicException('[PHP-Translation] To integrate with the Symfony profiler you first need to enable it. Please set framework.translator.enabled: true');
34
        }
35
    }
36
}
37