JKSamBundle   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 28
ccs 0
cts 19
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getContainerExtension() 0 22 5
1
<?php
2
3
namespace JK\SamBundle;
4
5
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
6
use Symfony\Component\HttpKernel\Bundle\Bundle;
7
8
class JKSamBundle extends Bundle
9
{
10
    /**
11
     * @return bool|ExtensionInterface
12
     */
13
    public function getContainerExtension()
14
    {
15
        if (null === $this->extension) {
16
            $class = $this->getContainerExtensionClass();
17
18
            if (class_exists($class)) {
19
                $extension = new $class();
20
21
                if (!$extension instanceof ExtensionInterface) {
22
                    throw new \LogicException(sprintf('Extension %s must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', $class));
23
                }
24
                $this->extension = $extension;
25
            } else {
26
                $this->extension = false;
27
            }
28
        }
29
        if ($this->extension) {
30
            return $this->extension;
31
        }
32
        
33
        return null;
34
    }
35
}
36