Completed
Push — master ( 785877...e6b000 )
by Tobias
17:05
created

LoaderOrReaderPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 17
ccs 8
cts 8
cp 1
rs 10
c 0
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 1
            $container->setAlias('translation.loader_or_reader', 'translation.reader');
28
29 1
            return;
30
        }
31
32 15
        if ($container->has('translation.loader')) {
33 14
            $container->setAlias('translation.loader_or_reader', 'translation.loader');
34
35 14
            return;
36
        }
37 1
    }
38
}
39