GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

M6WebApiExceptionExtension::load()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
ccs 5
cts 5
cp 1
cc 1
eloc 5
nc 1
nop 2
crap 1
1
<?php
2
3
namespace M6Web\Bundle\ApiExceptionBundle\DependencyInjection;
4
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
7
use Symfony\Component\DependencyInjection\Definition;
8
use Symfony\Component\DependencyInjection\Reference;
9
10
/**
11
 * This is the class that loads and manages your bundle configuration
12
 */
13
class M6WebApiExceptionExtension extends Extension
14
{
15
    /**
16
     * {@inheritDoc}
17
     */
18
    public function load(array $configs, ContainerBuilder $container)
19
    {
20 1
        $configuration = new Configuration();
21 1
        $config = $this->processConfiguration($configuration, $configs);
22
23 1
        $this->loadExceptionManager($container, $config);
24 1
        $this->loadExceptionListener($container, $config);
25 1
    }
26
27
    /**
28
     * @return string
29
     */
30
    public function getAlias()
31
    {
32 1
        return 'm6web_api_exception';
33
    }
34
35
    /**
36
     * load service exception manager
37
     *
38
     * @param ContainerBuilder $container
39
     * @param array            $config
40
     */
41
    protected function loadExceptionManager(ContainerBuilder $container, array $config)
42
    {
43 1
        $definition = new Definition(
44 1
            'M6Web\Bundle\ApiExceptionBundle\Manager\ExceptionManager',
45
            [
46 1
                $config['default'],
47 1
                $config['exceptions'],
48
            ]
49 1
        );
50
51 1
        $container->setDefinition($this->getAlias().'.manager.exception', $definition);
52 1
    }
53
54
    /**
55
     * load service exception listener
56
     *
57
     * @param ContainerBuilder $container
58
     * @param array            $config
59
     */
60
    protected function loadExceptionListener(ContainerBuilder $container, array $config)
61
    {
62 1
        $definition = new Definition(
63 1
            'M6Web\Bundle\ApiExceptionBundle\EventListener\ExceptionListener',
64
            [
65 1
                new Reference('kernel'),
66 1
                new Reference($this->getAlias().'.manager.exception'),
67 1
                $config['match_all'],
68 1
                $config['default'],
69 1
                $config['stack_trace'],
70
            ]
71 1
        );
72
73 1
        $definition->addTag(
74 1
            'kernel.event_listener',
75
            [
76 1
                'event' => 'kernel.exception',
77 1
                'method' => 'onKernelException',
78
                'priority' => '-100' // as the setresponse stop the exception propagation, this listener has to pass in last position
79 1
            ]
80 1
        );
81
82 1
        $container->setDefinition($this->getAlias().'.listener.exception', $definition);
83 1
    }
84
}
85