SumoCodersFrameworkErrorExtension   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 4
dl 0
loc 42
ccs 18
cts 18
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B loadInternal() 0 36 5
1
<?php
2
3
namespace SumoCoders\FrameworkErrorBundle\DependencyInjection;
4
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\HttpKernel\DependencyInjection\ConfigurableExtension;
7
use Symfony\Component\DependencyInjection\Definition;
8
use Symfony\Component\DependencyInjection\Reference;
9
10
class SumoCodersFrameworkErrorExtension extends ConfigurableExtension
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15 2
    protected function loadInternal(array $mergedConfig, ContainerBuilder $container)
16
    {
17 2
        $showMessagesFor = array();
18
19 2
        if (isset($mergedConfig['show_messages_for'])) {
20 2
            $showMessagesFor = array_unique($mergedConfig['show_messages_for']);
21
        }
22
23
        // store the configuration in the messages
24 2
        $container->setParameter(
25 2
            'sumo_coders_framework_error.show_messages_for',
26
            $showMessagesFor
27
        );
28
29
        if (
30 2
            $container->hasParameter('errbit_api_key')
31 2
            && $container->getParameter('errbit_api_key') !== null
32 2
            && $container->getParameter('errbit_api_key') !== ''
33
        ) {
34 1
            $definition = new Definition(
35 1
                'SumoCoders\FrameworkErrorBundle\Listener\ConsoleExceptionListener',
36 1
                array(new Reference('eo_airbrake.client'))
37
            );
38 1
            $definition->addTag(
39 1
                'kernel.event_listener',
40
                array(
41 1
                    'event' => 'console.exception',
42
                    'method' => 'onConsoleException',
43
                )
44
            );
45 1
            $container->setDefinition(
46 1
                'sumocoders_console_error_handler',
47
                $definition
48
            );
49
        }
50 2
    }
51
}
52