Completed
Pull Request — master (#36)
by
unknown
11:47
created

AsmTranslationLoaderBundle::build()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 21
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 6
Bugs 2 Features 0
Metric Value
c 6
b 2
f 0
dl 0
loc 21
rs 9.3142
cc 2
eloc 16
nc 2
nop 1
1
<?php
2
/*
3
 * This file is part of the AsmTranslationLoaderBundle package.
4
 *
5
 * (c) Marc Aschmann <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace Asm\TranslationLoaderBundle;
11
12
use Asm\TranslationLoaderBundle\DependencyInjection\Compiler\AddResourcePass;
13
use Asm\TranslationLoaderBundle\DependencyInjection\Compiler\LegacyRegisterListenersPass;
14
use Asm\TranslationLoaderBundle\DependencyInjection\Compiler\RegisterFileLoadersPass;
15
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\HttpKernel\Bundle\Bundle;
18
use Symfony\Component\HttpKernel\DependencyInjection\RegisterListenersPass;
19
20
/**
21
 * Class AsmTranslationLoaderBundle
22
 *
23
 * @package Asm\TranslationLoaderBundle
24
 * @author Marc Aschmann <[email protected]>
25
 */
26
class AsmTranslationLoaderBundle extends Bundle
27
{
28
    /**
29
     * {@inheritDoc}
30
     */
31
    public function build(ContainerBuilder $container)
32
    {
33
        parent::build($container);
34
35
        $container->addCompilerPass(new AddResourcePass());
36
        $container->addCompilerPass(new RegisterFileLoadersPass());
37
38
        if (class_exists('Symfony\Component\HttpKernel\DependencyInjection\RegisterListenersPass')) {
39
            $container->addCompilerPass(new RegisterListenersPass(
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Component\HttpKe...n\RegisterListenersPass has been deprecated with message: since version 2.5, to be removed in 3.0. Use the Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass class instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
40
                'asm_translation_loader.event_dispatcher',
41
                'asm_translation_loader.event_listener',
42
                'asm_translation_loader.event_subscriber'
43
            ), PassConfig::TYPE_BEFORE_REMOVING);
44
        } else {
45
            $container->addCompilerPass(new LegacyRegisterListenersPass(
46
                'asm_translation_loader.event_dispatcher',
47
                'asm_translation_loader.event_listener',
48
                'asm_translation_loader.event_subscriber'
49
            ), PassConfig::TYPE_BEFORE_REMOVING);
50
        }
51
    }
52
}
53