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

ConfigCompilerPass::process()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2.0117

Importance

Changes 13
Bugs 0 Features 4
Metric Value
c 13
b 0
f 4
dl 0
loc 11
ccs 6
cts 7
cp 0.8571
rs 9.4286
cc 2
eloc 7
nc 2
nop 1
crap 2.0117
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