Passed
Push — master ( d27c52...62b14a )
by Andrea
18:17
created

GrigliaExtraFunzioniUtils   A

Complexity

Total Complexity 27

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Test Coverage

Coverage 64.44%

Importance

Changes 0
Metric Value
wmc 27
eloc 47
dl 0
loc 73
ccs 29
cts 45
cp 0.6444
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
B getColonneLink() 0 15 10
A valorizzaColonna() 0 25 6
B valorizzaVettoreType() 0 22 11
1
<?php
2
3
namespace Fi\CoreBundle\Utils;
4
5
class GrigliaExtraFunzioniUtils
6
{
7 19
    public static function getColonneLink($paricevuti, &$modellocolonne)
8
    {
9 19
        $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 19
        $colonne_link = isset($paricevuti['colonne_link']) ? $paricevuti['colonne_link'] : array();
11 19
        if (($output == 'stampa') || !isset($colonne_link)) {
12
            return;
13
        }
14
15 19
        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
        }
27 19
    }
28 5
    public static function valorizzaColonna(&$vettoreriga, $parametri)
29
    {
30 5
        $tabella = $parametri['tabella'];
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...
31 5
        $nomecampo = $parametri['nomecampo'];
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...
32 5
        $doctrine = $parametri['doctrine'];
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 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...
33 5
        $decodifiche = $parametri['decodifiche'];
34
35 5
        $vettoreparcampi = $doctrine->getMetadataFactory()->getMetadataFor($tabella)->fieldMappings;
36
37 5
        if (is_object($vettoreparcampi)) {
38
            $vettoreparcampi = get_object_vars($vettoreparcampi);
39
        }
40
41 5
        $singolocampo = $parametri['singolocampo'];
42
43 5
        if (isset($decodifiche[$nomecampo]) && isset($decodifiche[$nomecampo][$singolocampo])) {
44
            $ordinecampo = $parametri['ordinecampo'];
45
            if (isset($ordinecampo)) {
46
                $vettoreriga[$ordinecampo] = $decodifiche[$nomecampo][$singolocampo];
47
            } else {
48
                $vettoreriga[] = $decodifiche[$nomecampo][$singolocampo];
49
            }
50
        } else {
51 5
            $vettoretype = isset($vettoreparcampi[$nomecampo]['type']) ? $vettoreparcampi[$nomecampo]['type'] : null;
52 5
            self::valorizzaVettoreType($vettoreparcampi, $vettoreriga, $vettoretype, $parametri);
53
        }
54 5
    }
55
    
56 5
    public static function valorizzaVettoreType(&$vettoreparcampi, &$vettoreriga, $vettoretype, $parametri)
57
    {
58 5
        $nomecampo = $parametri['nomecampo'];
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 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...
59 5
        $ordinecampo = $parametri['ordinecampo'];
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...
60 5
        $singolocampo = $parametri['singolocampo'];
61 5
        if (isset($vettoretype) && ($vettoretype == 'date' || $vettoretype == 'datetime') && $singolocampo) {
62 5
            if (isset($ordinecampo)) {
63 5
                $vettoreriga[$ordinecampo] = $singolocampo->format('d/m/Y');
64
            } else {
65 5
                $vettoreriga[] = $singolocampo->format('d/m/Y');
66
            }
67 5
        } elseif (isset($vettoretype) && ($vettoreparcampi[$nomecampo]['type'] == 'time') && $singolocampo) {
68
            if (isset($ordinecampo)) {
69
                $vettoreriga[$ordinecampo] = $singolocampo->format('H:i');
70
            } else {
71
                $vettoreriga[] = $singolocampo->format('H:i');
72
            }
73
        } else {
74 5
            if (isset($ordinecampo)) {
75 5
                $vettoreriga[$ordinecampo] = $singolocampo;
76
            } else {
77
                $vettoreriga[] = $singolocampo;
78
            }
79
        }
80 5
    }
81
}
82