Completed
Pull Request — master (#310)
by Piotr
01:50
created

FSiAdminBundle   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 12
dl 0
loc 33
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getContainerExtension() 0 8 2
A build() 0 15 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(
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