Completed
Pull Request — 2.1 (#267)
by Piotr
02:14
created

FSiAdminBundle.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 * (c) FSi sp. z o.o. <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace FSi\Bundle\AdminBundle;
11
12
use Doctrine\Common\Annotations\AnnotationReader;
13
use FSi\Bundle\AdminBundle\DependencyInjection\Compiler\AdminAnnotatedElementPass;
14
use FSi\Bundle\AdminBundle\DependencyInjection\Compiler\AdminElementPass;
15
use FSi\Bundle\AdminBundle\DependencyInjection\Compiler\ContextPass;
16
use FSi\Bundle\AdminBundle\DependencyInjection\Compiler\KnpMenuBuilderPass;
17
use FSi\Bundle\AdminBundle\DependencyInjection\Compiler\ManagerVisitorPass;
18
use FSi\Bundle\AdminBundle\DependencyInjection\Compiler\ResourceRepositoryPass;
19
use FSi\Bundle\AdminBundle\DependencyInjection\Compiler\SetEventDispatcherPass;
20
use FSi\Bundle\AdminBundle\DependencyInjection\Compiler\TwigGlobalsPass;
21
use FSi\Bundle\AdminBundle\DependencyInjection\FSIAdminExtension;
22
use FSi\Bundle\AdminBundle\Finder\AdminClassFinder;
23
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
24
use Symfony\Component\DependencyInjection\ContainerBuilder;
25
use Symfony\Component\HttpKernel\Bundle\Bundle;
26
27
/**
28
 * @author Norbert Orzechowicz <[email protected]>
29
 */
30
class FSiAdminBundle extends Bundle
31
{
32
    /**
33
     * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
34
     */
35
    public function build(ContainerBuilder $container)
36
    {
37
        parent::build($container);
38
39
        $container->addCompilerPass(new AdminAnnotatedElementPass(
40
            new AnnotationReader(),
41
            new AdminClassFinder()
42
        ));
43
        $container->addCompilerPass(new AdminElementPass(), PassConfig::TYPE_BEFORE_REMOVING);
44
        $container->addCompilerPass(new KnpMenuBuilderPass());
45
        $container->addCompilerPass(new ResourceRepositoryPass());
46
        $container->addCompilerPass(new ManagerVisitorPass());
47
        $container->addCompilerPass(new ContextPass());
48
        $container->addCompilerPass(new TwigGlobalsPass());
49
        $container->addCompilerPass(new SetEventDispatcherPass());
50
    }
51
52
    /**
53
     * @return \FSi\Bundle\AdminBundle\DependencyInjection\FSIAdminExtension
54
     */
55
    public function getContainerExtension()
56
    {
57
        if (null === $this->extension) {
58
            $this->extension = new FSIAdminExtension();
59
        }
60
61
        return $this->extension;
0 ignored issues
show
Comprehensibility Best Practice introduced by
The expression $this->extension; of type Symfony\Component\Depend...xtensionInterface|false adds false to the return on line 61 which is incompatible with the return type declared by the interface Symfony\Component\HttpKe...::getContainerExtension of type Symfony\Component\Depend...ExtensionInterface|null. It seems like you forgot to handle an error condition.
Loading history...
62
    }
63
}
64