Completed
Push — master ( afc178...f9ad3c )
by Krzysztof
06:00
created

ElkBridgeExtension   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 0
cbo 5
dl 0
loc 30
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 16 2
A getAlias() 0 4 1
1
<?php
2
3
namespace Clearcode\SimpleBusElkBundle\DependencyInjection;
4
5
use Symfony\Component\Config\FileLocator;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Extension\Extension;
8
use Symfony\Component\DependencyInjection\Loader;
9
10
class ElkBridgeExtension extends Extension
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function load(array $config, ContainerBuilder $container)
16
    {
17
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config/'));
18
        $loader->load('services.yml');
19
20
        $configuration = new Configuration();
21
        $config        = $this->processConfiguration($configuration, $config);
22
23
        $container->setParameter('simple_bus_elk.logstash_namespace', $config['logstash_namespace']);
24
        $container->setParameter('simple_bus_elk.monolog_channel', $config['monolog_channel']);
25
        $container->setParameter('simple_bus_elk.enable_simple_bus_middleware', $config['enable_simple_bus_middleware']);
26
27
        if ($config['enable_simple_bus_middleware']) {
28
            $loader->load('event_bus.yml');
29
        }
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function getAlias()
36
    {
37
        return 'simple_bus_elk';
38
    }
39
}
40