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

GpsLabDomainEventBundle   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 35.7%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
lcom 1
cbo 4
dl 0
loc 27
ccs 5
cts 14
cp 0.357
rs 10
c 2
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 6 1
A getContainerExtension() 0 14 3
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