Completed
Pull Request — master (#311)
by Łukasz
02:46
created

FSiAdminBundle::build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 15
rs 9.4285
cc 1
eloc 11
nc 1
nop 1
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(
0 ignored issues
show
Deprecated Code introduced by
The class FSi\Bundle\AdminBundle\D...minAnnotatedElementPass has been deprecated with message: since 3.0

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...
39
            new AnnotationReader(),
40
            new AdminClassFinder()
0 ignored issues
show
Deprecated Code introduced by
The class FSi\Bundle\AdminBundle\Finder\AdminClassFinder has been deprecated with message: since 3.0

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...
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