Passed
Push — master ( 1d619d...8f091f )
by Andrea
16:20
created

FiController   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getBundle() 0 3 1
A getController() 0 3 1
A getPermessi() 0 3 1
A __construct() 0 14 3
A getUser() 0 3 1
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, 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...
13
14
    protected $bundle;
15
    protected $controller;
16
    protected $permessi;
17
18 17
    public function __construct(TokenStorageInterface $user, PermessiUtils $permessi)
19
    {
20 17
        $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 17
        $controllo = new \ReflectionClass(get_class($this));
22
23 17
        preg_match('/(.*)\\\(.*)\\\Controller\\\(.*)Controller/', $controllo->name, $matches);
24 17
        if (count($matches) == 0) {
25 10
            preg_match('/(.*)(.*)\\\Controller\\\(.*)Controller/', $controllo->name, $matches);
26
        }
27
28 17
        $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 17
        $this->controller = $matches[count($matches) - 1];
30 17
        $this->permessi = $permessi;
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 17
        $this->user = $user;
0 ignored issues
show
Bug Best Practice introduced by
The property user does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 7 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...
32 17
    }
33 13
    protected function getBundle()
34
    {
35 13
        return $this->bundle;
36
    }
37 17
    protected function getController()
38
    {
39 17
        return $this->controller;
40
    }
41 17
    protected function getPermessi()
42
    {
43 17
        return $this->permessi;
44
    }
45 7
    protected function getUser()
46
    {
47 7
        return $this->user->getToken()->getUser();
48
    }
49
}
50