Completed
Push — output_parsers_refactor ( cf2136...710907 )
by Alessandro
02:32
created

Paraunit::buildContainer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 21
ccs 14
cts 14
cp 1
rs 9.3142
cc 1
eloc 12
nc 1
nop 0
crap 1
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 7
    public static function buildContainer()
24
    {
25 7
        $containerBuilder = new ContainerBuilder();
26
27 7
        $loader = new YamlFileLoader($containerBuilder, new FileLocator(__DIR__ . '/../Resources/config/'));
28 7
        $loader->load('services.yml');
29
30 7
        $containerBuilder->addCompilerPass(new RegisterListenersPass());
31
32 7
        $containerBuilder->setDefinition(
33 7
            'event_dispatcher',
34 7
            new Definition(
35 7
                'Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher',
36 7
                array(new Reference('service_container'))
37 7
            )
38 7
        );
39
40 7
        $containerBuilder->compile();
41
42 7
        return $containerBuilder;
43
    }
44
}
45