Completed
Push — master ( 69263b...b8d5de )
by Andrea
14:35
created

GrigliaExtraFunzioniUtils::getColonneLink()   C

Complexity

Conditions 10
Paths 14

Size

Total Lines 21
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 25.6155

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 6
cts 13
cp 0.4615
rs 6.6746
c 0
b 0
f 0
cc 10
eloc 12
nc 14
nop 2
crap 25.6155

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\DependencyInjection;
4
5
class GrigliaExtraFunzioniUtils
6
{
7 13
    public static function getColonneLink($paricevuti, &$modellocolonne)
8
    {
9 13
        $output = GrigliaParametriUtils::getOuputType($paricevuti);
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';
21
                            $modellocolonne[$key]['formatoptions'] = $parametricolonna;
22
                        }
23
                    }
24
                }
25
            }
26
        }
27 13
    }
28
}
29