Completed
Push — output_parsers_refactor ( 5337aa...a0f5ee )
by Alessandro
03:14
created

Paraunit::getTempBaseDir()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3.1406

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
ccs 6
cts 8
cp 0.75
rs 9.4285
cc 3
eloc 7
nc 3
nop 0
crap 3.1406
1
<?php
2
3
namespace Paraunit\Configuration;
4
5
use Symfony\Component\Config\FileLocator;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Definition;
8
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
9
use Symfony\Component\DependencyInjection\Reference;
10
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
11
12
/**
13
 * Class Paraunit
14
 * @package Paraunit\Configuration
15
 */
16
class Paraunit
17
{
18
    const PARAUNIT_VERSION = '0.5.1';
19
20
    /**
21
     * @return ContainerBuilder
22
     */
23 27
    public static function buildContainer()
24
    {
25 27
        $containerBuilder = new ContainerBuilder();
26
27 27
        $loader = new YamlFileLoader($containerBuilder, new FileLocator(__DIR__ . '/../Resources/config/'));
28 27
        $loader->load('configuration.yml');
29 27
        $loader->load('file.yml');
30 27
        $loader->load('output_container.yml');
31 27
        $loader->load('parser.yml');
32 27
        $loader->load('printer.yml');
33 27
        $loader->load('services.yml');
34
35 27
        $containerBuilder->addCompilerPass(new RegisterListenersPass());
36
37 27
        $containerBuilder->setDefinition(
38 27
            'event_dispatcher',
39 27
            new Definition(
40 27
                'Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher',
41 27
                array(new Reference('service_container'))
42 27
            )
43 27
        );
44
45 27
        $containerBuilder->compile();
46
47 27
        return $containerBuilder;
48
    }
49
}
50