Passed
Push — master ( 2a39ec...3b6c56 )
by Andrea
03:42
created

PermessiController::indexAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 51
Code Lines 38

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 23
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 38
dl 0
loc 51
ccs 23
cts 23
cp 1
rs 9.312
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace Fi\CoreBundle\Controller;
4
5
use Symfony\Component\HttpFoundation\Request;
6
use Fi\CoreBundle\Entity\Permessi;
7
8
/**
9
 * Permessi controller.
10
 */
11
class PermessiController extends FiCoreController
12
{
13
14
    /**
15
     * Lists all Ffprincipale entities.
16
     */
17 1
    public function indexAction(Request $request)
18
    {
19 1
        $this->setup($request);
20 1
        $namespace = $this->getNamespace();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 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 1
        $bundle = $this->getBundle();
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...
22 1
        $controller = $this->getController();
23 1
        $container = $this->container;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 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...
24
25 1
        $nomebundle = $namespace . $bundle . 'Bundle';
26
27 1
        $em = $this->getDoctrine()->getManager();
0 ignored issues
show
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...
28 1
        $entities = $em->getRepository($nomebundle . ':' . $controller)->findAll();
29
30
        $dettaglij = array(
31 1
            'operatori_id' => array(
32
                array('nomecampo' => 'operatori.username',
33
                    'lunghezza' => '200',
34
                    'descrizione' => 'Username',
35
                    'tipo' => 'text',),
36
                array('nomecampo' => 'operatori.operatore',
37
                    'lunghezza' => '200',
38
                    'descrizione' => 'Operatore',
39
                    'tipo' => 'text',),
40
            ),
41
            'ruoli_id' => array(
42
                array('nomecampo' => 'ruoli.ruolo',
43
                    'lunghezza' => '200',
44
                    'descrizione' => 'Ruolo',
45
                    'tipo' => 'text',),
46
            ),
47
        );
48
49
        $paricevuti = array(
50 1
            'doctrine' => $em,
51 1
            'nomebundle' => $nomebundle,
52 1
            'nometabella' => $controller,
53 1
            'dettaglij' => $dettaglij,
54 1
            'container' => $container,);
55
56 1
        $griglia = $this->get("ficorebundle.griglia");
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 23 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...
Coding Style Comprehensibility introduced by
The string literal ficorebundle.griglia does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
57 1
        $testatagriglia = $griglia->testataPerGriglia($paricevuti);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 16 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...
58 1
        $testatagriglia['overlayopen'] = 1;
59
60 1
        $testata = json_encode($testatagriglia);
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...
61
        $twigparms = array(
62 1
            'entities' => $entities,
63 1
            'nomecontroller' => $controller,
64 1
            'testata' => $testata,
65
        );
66
67 1
        return $this->render($nomebundle . ':' . $controller . ':index.html.twig', $twigparms);
68
    }
69
70
    public function setParametriGriglia($prepar = array())
71
    {
72
        $this->setup($prepar['request']);
73
        $namespace = $this->getNamespace();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 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...
74
        $bundle = $this->getBundle();
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...
75
        $controller = $this->getController();
76
77
        $nomebundle = $namespace . $bundle . 'Bundle';
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 15 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...
78
        $escludi = array();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 18 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...
79
        $tabellej = array();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 17 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...
80
        $tabellej['operatori_id'] = array('tabella' => 'operatori', 'campi' => array('username', 'operatore'));
81
        $tabellej['ruoli_id'] = array('tabella' => 'ruoli', 'campi' => array('ruolo'));
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...
82
83
        $paricevuti = array(
84
            'container' => $this->container,
85
            'nomebundle' => $nomebundle,
86
            'tabellej' => $tabellej,
87
            'nometabella' => $controller,
88
            'escludere' => $escludi,
89
        );
90
91
        if (! empty($prepar)) {
92
            $paricevuti = array_merge($paricevuti, $prepar);
93
        }
94
95
        self::$parametrigriglia = $paricevuti;
96
    }
97
}
98