Completed
Push — master ( e6b000...3053d6 )
by Tobias
08:59
created

LoaderOrReaderPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 75%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 17
ccs 6
cts 8
cp 0.75
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 14 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
17
/**
18
 * To provide a BC layer for Symfony 2.7 to 3.3 this compiler pass
19
 * registers an alias of whether TranslationReader or TranslationLoader
20
 * to be able to inject it in other services.
21
 */
22
class LoaderOrReaderPass implements CompilerPassInterface
23
{
24 16
    public function process(ContainerBuilder $container)
25
    {
26 16
        if ($container->has('translation.reader')) {
27 15
            $container->setAlias('translation.loader_or_reader', 'translation.reader');
28
29 15
            return;
30
        }
31
32 1
        if ($container->has('translation.loader')) {
33
            $container->setAlias('translation.loader_or_reader', 'translation.loader');
34
35
            return;
36
        }
37 1
    }
38
}
39