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

Paraunit   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 1
c 2
b 0
f 0
lcom 0
cbo 6
dl 0
loc 29
ccs 14
cts 14
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A buildContainer() 0 21 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