Completed
Push — master ( b529ec...37c22b )
by Jarek
11s
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\TwigGlobalsPass;
20
use FSi\Bundle\AdminBundle\DependencyInjection\FSIAdminExtension;
21
use FSi\Bundle\AdminBundle\Finder\AdminClassFinder;
22
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
23
use Symfony\Component\DependencyInjection\ContainerBuilder;
24
use Symfony\Component\HttpKernel\Bundle\Bundle;
25
26
/**
27
 * @author Norbert Orzechowicz <[email protected]>
28
 */
29
class FSiAdminBundle extends Bundle
30
{
31
    /**
32
     * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
33
     */
34
    public function build(ContainerBuilder $container)
35
    {
36
        parent::build($container);
37
38
        $container->addCompilerPass(new AdminAnnotatedElementPass(
39
            new AnnotationReader(),
40
            new AdminClassFinder()
41
        ));
42
        $container->addCompilerPass(new AdminElementPass(), PassConfig::TYPE_REMOVE);
43
        $container->addCompilerPass(new KnpMenuBuilderPass());
44
        $container->addCompilerPass(new ResourceRepositoryPass());
45
        $container->addCompilerPass(new ManagerVisitorPass());
46
        $container->addCompilerPass(new ContextPass());
47
        $container->addCompilerPass(new TwigGlobalsPass());
48
    }
49
50
    /**
51
     * @return \FSi\Bundle\AdminBundle\DependencyInjection\FSIAdminExtension
52
     */
53
    public function getContainerExtension()
54
    {
55
        if (null === $this->extension) {
56
            $this->extension = new FSIAdminExtension();
57
        }
58
59
        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 59 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...
60
    }
61
}
62