ConfigCompilerPass   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 23
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 16 1
1
<?php
2
3
namespace BrainExe\Core\DependencyInjection\CompilerPass;
4
5
use BrainExe\Core\Annotations\CompilerPass;
6
use BrainExe\Core\Environment;
7
use Symfony\Component\Config\FileLocator;
8
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
11
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
12
13
/**
14
 * @CompilerPass(priority=10)
15
 */
16
class ConfigCompilerPass implements CompilerPassInterface
17
{
18
19
    /**
20
     * {@inheritdoc}
21
     */
22 2
    public function process(ContainerBuilder $container)
23
    {
24 2
        $locator = new FileLocator([
25 2
            ROOT,
26 2
            ROOT . 'app/',
27
        ]);
28
29 2
        $xmlLoader = new XmlFileLoader($container, $locator);
30 2
        $xmlLoader->import('container.xml');
31
32 2
        $ymlLoader = new YamlFileLoader($container, $locator);
33 2
        $ymlLoader->import('config.yml', null, true);
34
35 2
        $environment = $container->getParameter('environment');
36 2
        $container->setParameter('debug', $environment !== Environment::PRODUCTION);
37 2
    }
38
}
39