IndragunawanMiddlewareExtension   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 15
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 10 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the MiddlewareBundle
7
 *
8
 * (c) Indra Gunawan <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Indragunawan\MiddlewareBundle\DependencyInjection;
15
16
use Indragunawan\MiddlewareBundle\Middleware\AfterFilterInterface;
17
use Indragunawan\MiddlewareBundle\Middleware\BeforeFilterInterface;
18
use Symfony\Component\Config\FileLocator;
19
use Symfony\Component\DependencyInjection\ContainerBuilder;
20
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
21
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
22
23
/**
24
 * @author Indra Gunawan <[email protected]>
25
 */
26
final class IndragunawanMiddlewareExtension extends Extension
27
{
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function load(array $configs, ContainerBuilder $container)
32
    {
33
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
34
        $loader->load('services.xml');
35
36
        $container->registerForAutoconfiguration(BeforeFilterInterface::class)
37
            ->addTag('indragunawan.middleware', ['event' => 'before_filter']);
38
39
        $container->registerForAutoconfiguration(AfterFilterInterface::class)
40
            ->addTag('indragunawan.middleware', ['event' => 'after_filter']);
41
    }
42
}
43