Completed
Push — master ( 2ff726...1b8ace )
by Andrea
09:31
created

GrigliaParametriUtils   A

Complexity

Total Complexity 26

Size/Duplication

Total Lines 113
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 81.97%

Importance

Changes 0
Metric Value
wmc 26
lcom 0
cbo 1
dl 0
loc 113
ccs 50
cts 61
cp 0.8197
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A getAliasTestataPerGriglia() 0 10 3
A getOrdineColonneTestataPerGriglia() 0 9 3
A getCampiEsclusiTestataPerGriglia() 0 4 2
A getParametriCampiExtraTestataPerGriglia() 0 4 2
A getDoctrineByEm() 0 10 2
A getDoctrineFiCoreByEm() 0 10 2
A getOuputType() 0 10 3
C getDatiEscludereDaTabella() 0 40 7
A getDatiEscludere() 0 4 2
1
<?php
2
3
namespace Fi\CoreBundle\DependencyInjection;
4
5
use Fi\CoreBundle\DependencyInjection\GrigliaUtils;
6
7
class GrigliaParametriUtils
8
{
9
10 13
    public static function getAliasTestataPerGriglia($paricevuti)
11
    {
12 13
        $alias = isset($paricevuti['dettaglij']) ? $paricevuti['dettaglij'] : array();
13
14 13
        if (is_object($alias)) {
15
            $alias = get_object_vars($alias);
16
        }
17
18 13
        return $alias;
19
    }
20
21 13
    public static function getOrdineColonneTestataPerGriglia($paricevuti)
22
    {
23 13
        $ordinecolonne = isset($paricevuti['ordinecolonne']) ? $paricevuti['ordinecolonne'] : null;
24 13
        if (!isset($ordinecolonne)) {
25 13
            $ordinecolonne = GrigliaUtils::ordinecolonne($paricevuti);
26 13
        }
27
28 13
        return $ordinecolonne;
29
    }
30
31 13
    public static function getCampiEsclusiTestataPerGriglia($paricevuti)
32
    {
33 13
        return isset($paricevuti['escludere']) ? $paricevuti['escludere'] : null;
34
    }
35
36 13
    public static function getParametriCampiExtraTestataPerGriglia($paricevuti)
37
    {
38 13
        return isset($paricevuti['campiextra']) ? $paricevuti['campiextra'] : null;
39
    }
40
41 13
    public static function getDoctrineByEm($parametri)
42
    {
43 13
        if (isset($parametri['em'])) {
44
            $doctrine = $parametri['container']->get('doctrine')->getManager($parametri['em']);
45
        } else {
46 13
            $doctrine = $parametri['container']->get('doctrine')->getManager();
47
        }
48
49 13
        return $doctrine;
50
    }
51
52 13
    public static function getDoctrineFiCoreByEm($parametri, $doctrine)
53
    {
54 13
        if (isset($parametri['emficore'])) {
55
            $doctrineficore = $parametri['container']->get('doctrine')->getManager($parametri['emficore']);
56
        } else {
57 13
            $doctrineficore = &$doctrine;
58
        }
59
60 13
        return $doctrineficore;
61
    }
62
63 13
    public static function getOuputType($parametri)
64
    {
65 13
        if ((isset($parametri['output'])) && ($parametri['output'] == 'stampa')) {
66
            $output = 'stampa';
67
        } else {
68 13
            $output = 'index';
69
        }
70
71 13
        return $output;
72
    }
73
74 1
    public static function getDatiEscludereDaTabella($parametri)
75
    {
76 1
        if (!isset($parametri["nometabella"])) {
77
            return false;
78
        }
79
80 1
        if ((isset($parametri["output"])) && ($parametri["output"] == "stampa")) {
81
            $output = "stampa";
82
        } else {
83 1
            $output = "index";
84
        }
85
86 1
        $nometabella = $parametri["nometabella"];
87
88 1
        $container = $parametri['container'];
89 1
        $doctrine = $container->get('doctrine');
90
91
        //$bundle = $parametri["nomebundle"];
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
92
        //Fisso il CoreBundle perchè si passa sempre da questo bundle per le esclusioni
93 1
        $bundle = "FiCoreBundle";
94 1
        $gestionepermessi = $container->get("ficorebundle.gestionepermessi");
95 1
        $operatorecorrente = $gestionepermessi->utentecorrente();
96
97 1
        $escludi = array();
98
99 1
        $q = $doctrine->getRepository($bundle . ":tabelle")->findBy(array("operatori_id" => $operatorecorrente["id"], "nometabella" => $nometabella));
100
101 1
        if (!$q) {
102 1
            unset($q);
103 1
            $q = $doctrine->getRepository($bundle . ":tabelle")->findBy(array("operatori_id" => null, "nometabella" => $nometabella));
104 1
        }
105
106 1
        if ($q) {
107 1
            foreach ($q as $riga) {
108 1
                $escludi[] = GrigliaUtils::getCampiEsclusi($riga, $output);
109 1
            }
110 1
        }
111
112 1
        return $escludi;
113
    }
114
115 1
    public static function getDatiEscludere($parametri)
116
    {
117 1
        return isset($parametri['escludere']) ? $parametri['escludere'] : null;
118
    }
119
}
120