Completed
Push — master ( 3d6a71...4fcc05 )
by Peter
05:12
created

GpsLabPaginationBundle::getContainerExtension()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 18
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 4

Importance

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