getContainerExtension()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
namespace MediaMonks\SonataMediaBundle;
4
5
use MediaMonks\SonataMediaBundle\DependencyInjection\Compiler\ProviderPass;
6
use MediaMonks\SonataMediaBundle\DependencyInjection\MediaMonksSonataMediaExtension;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\HttpKernel\Bundle\Bundle;
9
10
/**
11
 * @author Robert Slootjes <[email protected]>
12
 */
13
class MediaMonksSonataMediaBundle extends Bundle
14
{
15
    const BUNDLE_CONFIG_NAME = 'mediamonks_sonata_media';
16
17
    /**
18
     * @param ContainerBuilder $container
19
     */
20 1
    public function build(ContainerBuilder $container)
21
    {
22 1
        $container->addCompilerPass(new ProviderPass());
23 1
    }
24
25
    /**
26
     * @inheritdoc
27
     */
28 1
    public function getContainerExtension()
29
    {
30 1
        if (null === $this->extension) {
31 1
            $this->extension = new MediaMonksSonataMediaExtension();
32
        }
33
34 1
        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 34 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...
35
    }
36
}
37