Completed
Push — master ( 8123f4...f24b1b )
by Peter
03:06
created

GpsLabDateBundle::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 0
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\DateBundle;
11
12
use GpsLab\Bundle\DateBundle\DependencyInjection\Compiler\TimeZoneResolverPass;
13
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
14
use Symfony\Component\HttpKernel\Bundle\Bundle;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
17
class GpsLabDateBundle extends Bundle
18
{
19
    /**
20
     * @param ContainerBuilder $container
21
     */
22
    public function build(ContainerBuilder $container)
23
    {
24
        parent::build($container);
25
        $container->addCompilerPass(new TimeZoneResolverPass());
26
    }
27
28
    /**
29
     * @return ExtensionInterface|bool
30
     */
31
    public function getContainerExtension()
32
    {
33
        if (null === $this->extension) {
34
            $extension = $this->createContainerExtension();
35
36
            if ($extension instanceof ExtensionInterface) {
37
                $this->extension = $extension;
38
            } else {
39
                $this->extension = false;
40
            }
41
        }
42
43
        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 43 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...
44
    }
45
}
46