Completed
Push — master ( 007cba...a69311 )
by Christian
01:55 queued 11s
created

FOSRestBundle::build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 0
cts 8
cp 0
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
/*
4
 * This file is part of the FOSRestBundle package.
5
 *
6
 * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace FOS\RestBundle;
13
14
use FOS\RestBundle\DependencyInjection\Compiler\ConfigurationCheckPass;
15
use FOS\RestBundle\DependencyInjection\Compiler\HandlerRegistryDecorationPass;
16
use FOS\RestBundle\DependencyInjection\Compiler\JMSFormErrorHandlerPass;
17
use FOS\RestBundle\DependencyInjection\Compiler\JMSHandlersPass;
18
use FOS\RestBundle\DependencyInjection\Compiler\FormatListenerRulesPass;
19
use FOS\RestBundle\DependencyInjection\Compiler\SerializerConfigurationPass;
20
use Symfony\Component\DependencyInjection\ContainerBuilder;
21
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
22
use Symfony\Component\HttpKernel\Bundle\Bundle;
23
24
/**
25
 * @author Lukas Kahwe Smith <[email protected]>
26
 * @author Eriksen Costa <[email protected]>
27
 */
28
class FOSRestBundle extends Bundle
29
{
30
    const ZONE_ATTRIBUTE = '_fos_rest_zone';
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function build(ContainerBuilder $container)
36
    {
37
        $container->addCompilerPass(new SerializerConfigurationPass());
38
        $container->addCompilerPass(new ConfigurationCheckPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -10);
39
        $container->addCompilerPass(new FormatListenerRulesPass());
40
        $container->addCompilerPass(new JMSFormErrorHandlerPass());
41
        $container->addCompilerPass(new JMSHandlersPass(), PassConfig::TYPE_BEFORE_REMOVING, -10);
42
        $container->addCompilerPass(new HandlerRegistryDecorationPass(), PassConfig::TYPE_AFTER_REMOVING);
43
    }
44
}
45