Completed
Push — master ( 4fcc05...a85859 )
by Peter
05:13
created

GpsLabPaginationBundle::getContainerExtension()   B

Complexity

Conditions 5
Paths 8

Size

Total Lines 17
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 5

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 17
ccs 12
cts 12
cp 1
rs 8.8571
c 1
b 0
f 0
cc 5
eloc 9
nc 8
nop 0
crap 5
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|null
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 1
        }
34
35 1
        return $this->extension ?: null;
36
    }
37
}
38