ElkBridgeExtension::getAlias()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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