Passed
Branch master (a0cc06)
by Dāvis
17:06
created

Extension   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setExt() 0 3 1
A getExtension() 0 3 1
A configure() 0 3 1
A __construct() 0 4 2
1
<?php
2
3
namespace Sludio\HelperBundle\DependencyInjection;
4
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
7
class Extension
8
{
9
    protected $ext;
10
11
    public function __construct($type)
12
    {
13
        $className = 'Sludio\\HelperBundle\\DependencyInjection\\Component\\'.ucfirst($type);
14
        $this->setExt(class_exists($className) ? new $className() : null);
15
    }
16
17
    public function configure(ContainerBuilder &$container)
18
    {
19
        return $this->getExtension()->configure($container);
20
    }
21
22
    public function getExtension()
23
    {
24
        return $this->ext;
25
    }
26
27
    function setExt($ext)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
28
    {
29
        $this->ext = $ext;
30
    }
31
}