Completed
Push — master ( 030030...90a95a )
by Matze
10:56 queued 07:21
created

ConfigCompilerPass   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 85.71%

Importance

Changes 13
Bugs 0 Features 4
Metric Value
wmc 2
c 13
b 0
f 4
lcom 0
cbo 3
dl 0
loc 18
ccs 6
cts 7
cp 0.8571
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 11 2
1
<?php
2
3
namespace BrainExe\Core\DependencyInjection\CompilerPass;
4
5
use BrainExe\Core\Annotations\CompilerPass;
6
use Symfony\Component\Config\FileLocator;
7
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
10
use Symfony\Component\Filesystem\Filesystem;
11
12
/**
13
 * @CompilerPass(priority=10)
14
 */
15
class ConfigCompilerPass implements CompilerPassInterface
16
{
17
18
    /**
19
     * {@inheritdoc}
20
     */
21 2
    public function process(ContainerBuilder $container)
22
    {
23 2
        $loader     = new XmlFileLoader($container, new FileLocator('config'));
24 2
        $filesystem = new FileSystem();
25
26 2
        if ($filesystem->exists(ROOT . 'app')) {
27
            $loader->load(ROOT . 'app/container.xml');
28
        } else {
29 2
            $loader->load(ROOT . '/container.xml');
30
        }
31 2
    }
32
}
33