NVBoosterPHPCRAssetsBundle   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 4
dl 0
loc 41
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getContainerExtension() 0 8 2
A build() 0 19 2
1
<?php
2
3
namespace NVBooster\PHPCRAssetsBundle;
4
5
use Symfony\Component\HttpKernel\Bundle\Bundle;
6
use NVBooster\PHPCRAssetsBundle\DependencyInjection\NVBoosterPHPCRAssetsExtension;
7
use NVBooster\PHPCRAssetsBundle\DependencyInjection\Compiler\TwigFormThemePass;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
use Doctrine\Bundle\PHPCRBundle\DependencyInjection\Compiler\DoctrinePhpcrMappingsPass;
10
11
/**
12
 * @author nvb
13
 *
14
 */
15
class NVBoosterPHPCRAssetsBundle extends Bundle
16
{
17
    /**
18
     * {@inheritDoc}
19
     *
20
     * @see \Symfony\Component\HttpKernel\Bundle\Bundle::getContainerExtension()
21
     */
22
    public function getContainerExtension()
23
    {
24
        if (null === $this->extension) {
25
            $this->extension = new NVBoosterPHPCRAssetsExtension();
26
        }
27
    
28
        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 28 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...
29
    }
30
    
31
    /**
32
     * {@inheritDoc}
33
     *
34
     * @see \Symfony\Component\HttpKernel\Bundle\Bundle::build()
35
     */
36
    public function build(ContainerBuilder $container)
37
    {
38
        parent::build($container);
39
    
40
        if (class_exists('Doctrine\Bundle\PHPCRBundle\DependencyInjection\Compiler\DoctrinePhpcrMappingsPass')) {
41
            $container->addCompilerPass(
42
                DoctrinePhpcrMappingsPass::createXmlMappingDriver(
43
                    array(
44
                        realpath(__DIR__ . '/Resources/config/doctrine-phpcr') => 'NVBooster\PHPCRAssetsBundle\Asset',
45
                    ),
46
                    array('cmf_core.persistence.phpcr.manager_name'),
47
                    false,
48
                    array('NVBoosterPHPCRAssetsBundle' => 'NVBooster\PHPCRAssetsBundle\Asset')
49
                )
50
            );
51
            
52
            $container->addCompilerPass(new TwigFormThemePass());
53
        }
54
    }
55
}
56