ElkBridgeExtension   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 17 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.middleware', $config['middleware']);
26
27
        if ($config['middleware']) {
28
            $loader->load('logstash.yml');
29
            $loader->load('middlewares.yml');
30
        }
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function getAlias()
37
    {
38
        return 'simple_bus_elk';
39
    }
40
}
41