Passed
Push — develop ( 8a58bb...763b43 )
by Andrea
26:21 queued 11:17
created

FiController::getPermessi()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Cdf\BiCoreBundle\Controller;
4
5
use Cdf\BiCoreBundle\Service\Permessi\PermessiManager;
6
use function count;
7
use ReflectionClass;
8
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
9
use Twig\Environment;
10
11
class FiController extends AbstractController
12
{
13
    use FiCoreControllerTrait;
14
    use FiCoreCrudControllerTrait;
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...
15
    use FiCoreTabellaControllerTrait;
16
17
    protected $bundle;
18
    protected $template;
19
    protected $controller;
20
    protected $permessi;
21
22 17
    public function __construct(PermessiManager $permessi, Environment $template)
23
    {
24 17
        $matches = [];
25 17
        $controllo = new ReflectionClass(get_class($this));
26
27 17
        preg_match('/(.*)\\\(.*)\\\Controller\\\(.*)Controller/', $controllo->name, $matches);
28 17
        if (0 == count($matches)) {
29 10
            preg_match('/(.*)(.*)\\\Controller\\\(.*)Controller/', $controllo->name, $matches);
30
        }
31
32 17
        $this->bundle = ($matches[count($matches) - 2] ? $matches[count($matches) - 2] : $matches[count($matches) - 3]);
33 17
        $this->controller = $matches[count($matches) - 1];
34 17
        $this->permessi = $permessi;
35 17
        $this->template = $template;
36 17
    }
37
38 12
    protected function getBundle()
39
    {
40 12
        return $this->bundle;
41
    }
42
43 17
    protected function getController()
44
    {
45 17
        return $this->controller;
46
    }
47
48 16
    protected function getPermessi()
49
    {
50 16
        return $this->permessi;
51
    }
52
53
    protected function getTemplate()
54
    {
55
        return $this->template;
56
    }
57
}
58