Completed
Push — develop ( 8c90e8...7c7e93 )
by Andrea
15:52
created

FiController::getBundle()   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\Utils\Permessi\PermessiUtils;
6
use Doctrine\Common\Persistence\ObjectManager;
7
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
8
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
9
10
class FiController extends AbstractController
11
{
12
    use FiCoreControllerTrait;
0 ignored issues
show
Bug introduced by
The trait Cdf\BiCoreBundle\Controller\FiCoreControllerTrait requires the property $request which is not provided by Cdf\BiCoreBundle\Controller\FiController.
Loading history...
13
14
    protected $bundle;
15
    protected $controller;
16
    protected $permessi;
17
18 16
    public function __construct(ObjectManager $em, TokenStorageInterface $user)
19
    {
20 16
        $matches = array();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
21 16
        $controllo = new \ReflectionClass(get_class($this));
22
23 16
        preg_match('/(.*)\\\(.*)\\\Controller\\\(.*)Controller/', $controllo->name, $matches);
24 16
        if (count($matches) == 0) {
25 9
            preg_match('/(.*)(.*)\\\Controller\\\(.*)Controller/', $controllo->name, $matches);
26
        }
27
28 16
        $this->bundle = ($matches[count($matches) - 2] ? $matches[count($matches) - 2] : $matches[count($matches) - 3]);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
29 16
        $this->controller = $matches[count($matches) - 1];
30 16
        $this->permessi = new PermessiUtils($em, $this->getController(), $user->getToken()->getUser());
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
31 16
    }
32 13
    protected function getBundle()
33
    {
34 13
        return $this->bundle;
35
    }
36 16
    protected function getController()
37
    {
38 16
        return $this->controller;
39
    }
40 16
    protected function getPermessi()
41
    {
42 16
        return $this->permessi;
43
    }
44
}
45