Completed
Push — master ( 9a4f90...d093fb )
by Christoph, René
02:01
created

GelfExtension::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 2
1
<?php
2
3
namespace RenePardon\GelfSupport\GelfBundle\DependencyInjection;
4
5
use RenePardon\GelfSupport\GelfBundle\MonologHandler;
6
use Symfony\Bundle\MonologBundle\DependencyInjection\MonologExtension as BaseMonologExtension;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
9
/**
10
 * Class GelfExtension
11
 *
12
 * This is the class that loads and manages your bundle configuration.
13
 *
14
 * @see     {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
15
 * @package RenePardon\GelfSupport\GelfBundle\DependencyInjection
16
 */
17
class GelfExtension extends BaseMonologExtension
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function load(array $configs, ContainerBuilder $container)
23
    {
24
        // First load the parent Monolog stuff
25
        parent::load($configs, $container);
26
27
        // Now configure our custom overwrites
28
        $configuration = new Configuration();
29
        $config = $this->processConfiguration($configuration, $configs);
30
31
        $container->setParameter('graylog.enabled', (bool)$config['graylog']['enabled']);
32
        $container->setParameter('graylog.host', (string)$config['graylog']['host']);
33
        $container->setParameter('graylog.port', (int)$config['graylog']['port']);
34
    }
35
}
36