Passed
Push — master ( 0b6dbd...69bbdb )
by Andrea
13:36 queued 09:48
created

FiController   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 42
ccs 19
cts 19
cp 1
rs 10
c 0
b 0
f 0
wmc 7

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 3
A getTemplate() 0 3 1
A getBundle() 0 3 1
A getController() 0 3 1
A getPermessi() 0 3 1
1
<?php
2
3
namespace Cdf\BiCoreBundle\Controller;
4
5
use Cdf\BiCoreBundle\Service\Permessi\PermessiManager;
6
use ReflectionClass;
7
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
8
use Symfony\Component\Templating\EngineInterface;
9
use function count;
10
11
class FiController extends AbstractController
12
{
13
    use FiCoreControllerTrait, FiCoreCrudControllerTrait, FiCoreTabellaControllerTrait;
0 ignored issues
show
Bug introduced by
The trait Cdf\BiCoreBundle\Control...CoreCrudControllerTrait requires the property $request which is not provided by Cdf\BiCoreBundle\Controller\FiController.
Loading history...
14
15
    protected $bundle;
16
    protected $template;
17
    protected $controller;
18
    protected $permessi;
19
20 17
    public function __construct(PermessiManager $permessi, EngineInterface $template)
21
    {
22 17
        $matches = array();
23 17
        $controllo = new ReflectionClass(get_class($this));
24
25 17
        preg_match('/(.*)\\\(.*)\\\Controller\\\(.*)Controller/', $controllo->name, $matches);
26 17
        if (0 == count($matches)) {
27 10
            preg_match('/(.*)(.*)\\\Controller\\\(.*)Controller/', $controllo->name, $matches);
28
        }
29
30 17
        $this->bundle = ($matches[count($matches) - 2] ? $matches[count($matches) - 2] : $matches[count($matches) - 3]);
31 17
        $this->controller = $matches[count($matches) - 1];
32 17
        $this->permessi = $permessi;
33 17
        $this->template = $template;
34 17
    }
35
36 13
    protected function getBundle()
37
    {
38 13
        return $this->bundle;
39
    }
40
41 17
    protected function getController()
42
    {
43 17
        return $this->controller;
44
    }
45
46 17
    protected function getPermessi()
47
    {
48 17
        return $this->permessi;
49
    }
50 10
    protected function getTemplate()
51
    {
52 10
        return $this->template;
53
    }
54
}
55