Passed
Push — master ( c09f3d...b68917 )
by Andrea
12:33
created

GrigliaExtraFunzioniUtils::getColonneLink()   B

Complexity

Conditions 10
Paths 14

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 29.8461

Importance

Changes 0
Metric Value
cc 10
eloc 11
nc 14
nop 2
dl 0
loc 15
ccs 5
cts 12
cp 0.4167
crap 29.8461
rs 7.2765
c 0
b 0
f 0

How to fix   Complexity   

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\Utils;
4
5
class GrigliaExtraFunzioniUtils
6
{
7 13
    public static function getColonneLink($paricevuti, &$modellocolonne)
8
    {
9 13
        $output = GrigliaParametriUtils::getOuputType($paricevuti);
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...
10 13
        $colonne_link = isset($paricevuti['colonne_link']) ? $paricevuti['colonne_link'] : array();
11 13
        if (($output == 'stampa') || !isset($colonne_link)) {
12
            return;
13
        }
14
15 13
        foreach ($colonne_link as $colonna_link) {
16
            foreach ($colonna_link as $nomecolonna => $parametricolonna) {
17
                foreach ($modellocolonne as $key => $value) {
18
                    foreach ($value as $keyv => $valuev) {
19
                        if (($keyv == 'name') && ($valuev == $nomecolonna)) {
20
                            $modellocolonne[$key]['formatter'] = 'showlink';
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...
21
                            $modellocolonne[$key]['formatoptions'] = $parametricolonna;
22
                        }
23
                    }
24
                }
25
            }
26 13
        }
27 13
    }
28
}
29