Completed
Push — master ( da0c61...a2c4ac )
by Peter
12:37
created

GpsLabDomainEventBundle::getContainerExtension()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 14
ccs 0
cts 9
cp 0
rs 9.4285
c 1
b 0
f 0
cc 3
eloc 8
nc 3
nop 0
crap 12
1
<?php
2
/**
3
 * GpsLab component.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2016, Peter Gribanov
7
 * @license   http://opensource.org/licenses/MIT
8
 */
9
10
namespace GpsLab\Bundle\DomainEvent;
11
12
use GpsLab\Bundle\DomainEvent\DependencyInjection\Compiler\NamedEventListenerPass;
13
use GpsLab\Bundle\DomainEvent\DependencyInjection\Compiler\VoterListenerPass;
14
use Symfony\Component\DependencyInjection\ContainerBuilder;
15
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
16
use Symfony\Component\HttpKernel\Bundle\Bundle;
17
18
class GpsLabDomainEventBundle extends Bundle
19
{
20 1
    public function build(ContainerBuilder $container)
21
    {
22 1
        parent::build($container);
23 1
        $container->addCompilerPass(new NamedEventListenerPass());
24 1
        $container->addCompilerPass(new VoterListenerPass());
25 1
    }
26
27
    /**
28
     * @return ExtensionInterface|bool
29
     */
30
    public function getContainerExtension()
31
    {
32
        if (null === $this->extension) {
33
            $extension = $this->createContainerExtension();
34
35
            if ($extension instanceof ExtensionInterface) {
36
                $this->extension = $extension;
37
            } else {
38
                $this->extension = false;
39
            }
40
        }
41
42
        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 42 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...
43
    }
44
}
45