Passed
Push — master ( ffa83f...6ce442 )
by Andrea
04:02
created

GrigliaExtraFunzioniUtils::valorizzaColonna()   B

Complexity

Conditions 7
Paths 16

Size

Total Lines 28
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 16
CRAP Score 7.0671

Importance

Changes 0
Metric Value
eloc 19
dl 0
loc 28
ccs 16
cts 18
cp 0.8889
rs 8.8333
c 0
b 0
f 0
cc 7
nc 16
nop 2
crap 7.0671
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 5
        if (is_object($decodifiche)) {
41
            $decodifiche = json_decode(json_encode($decodifiche), true);
42
        }
43
44 5
        $singolocampo = $parametri['singolocampo'];
45
46 5
        if (isset($decodifiche[$nomecampo]) && isset($decodifiche[$nomecampo][$singolocampo])) {
47 3
            $ordinecampo = $parametri['ordinecampo'];
48 3
            if (isset($ordinecampo)) {
49 3
                $vettoreriga[$ordinecampo] = $decodifiche[$nomecampo][$singolocampo];
50
            } else {
51 3
                $vettoreriga[] = $decodifiche[$nomecampo][$singolocampo];
52
            }
53
        } else {
54 5
            $vettoretype = isset($vettoreparcampi[$nomecampo]['type']) ? $vettoreparcampi[$nomecampo]['type'] : null;
55 5
            self::valorizzaVettoreType($vettoreparcampi, $vettoreriga, $vettoretype, $parametri);
56
        }
57 5
    }
58
    
59 5
    public static function valorizzaVettoreType(&$vettoreparcampi, &$vettoreriga, $vettoretype, $parametri)
60
    {
61 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...
62 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...
63 5
        $singolocampo = $parametri['singolocampo'];
64 5
        if (isset($vettoretype) && ($vettoretype == 'date' || $vettoretype == 'datetime') && $singolocampo) {
65 5
            if (isset($ordinecampo)) {
66 5
                $vettoreriga[$ordinecampo] = $singolocampo->format('d/m/Y');
67
            } else {
68 5
                $vettoreriga[] = $singolocampo->format('d/m/Y');
69
            }
70 5
        } elseif (isset($vettoretype) && ($vettoreparcampi[$nomecampo]['type'] == 'time') && $singolocampo) {
71
            if (isset($ordinecampo)) {
72
                $vettoreriga[$ordinecampo] = $singolocampo->format('H:i');
73
            } else {
74
                $vettoreriga[] = $singolocampo->format('H:i');
75
            }
76
        } else {
77 5
            if (isset($ordinecampo)) {
78 5
                $vettoreriga[$ordinecampo] = $singolocampo;
79
            } else {
80
                $vettoreriga[] = $singolocampo;
81
            }
82
        }
83 5
    }
84
}
85