Passed
Branch master (649e9d)
by Dmitry
02:03
created

JsonRequestExtension::loadInternal()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 8
cts 8
cp 1
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace SymfonyBundles\JsonRequestBundle\DependencyInjection;
4
5
use Symfony\Component\DependencyInjection\Definition;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\HttpKernel\DependencyInjection\ConfigurableExtension;
8
9
class JsonRequestExtension extends ConfigurableExtension
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14 2
    protected function loadInternal(array $configs, ContainerBuilder $container)
15
    {
16 2
        $listener = new Definition($configs['listener']['request_transformer']);
17
18 2
        $listener->addTag('kernel.event_listener', [
19 2
            'event' => 'kernel.request',
20 2
            'method' => 'onKernelRequest',
21 2
            'priority' => $configs['listener']['priority'],
22
        ]);
23
24 2
        $container->setDefinition('sb_json_request.request_transformer', $listener);
25 2
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30 2
    public function getAlias()
31
    {
32 2
        return 'sb_json_request';
33
    }
34
}
35