Completed
Push — develop ( a34271...127495 )
by Andrea
68:31 queued 06:29
created

TabellaOpzioniFromModelloColonneTrait   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 7

1 Method

Rating   Name   Duplication   Size   Complexity  
B setOpzioniTabellaFromModellocolonne() 0 20 7
1
<?php
2
3
namespace Cdf\BiCoreBundle\Utils\Tabella;
4
5
trait TabellaOpzioniFromModelloColonneTrait
6
{
7
    protected function setOpzioniTabellaFromModellocolonne(&$opzionibuilder)
8
    {
9
        foreach ($this->modellocolonne as $modellocolonna) {
10
            $campo = $this->bonificaNomeCampo($modellocolonna['nomecampo']);
0 ignored issues
show
Bug introduced by
It seems like bonificaNomeCampo() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

10
            /** @scrutinizer ignore-call */ 
11
            $campo = $this->bonificaNomeCampo($modellocolonna['nomecampo']);
Loading history...
11
            $this->getOpzionitabellaCampiExtra($campo, $modellocolonna, $opzionibuilder);
0 ignored issues
show
Bug introduced by
It seems like getOpzionitabellaCampiExtra() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

11
            $this->/** @scrutinizer ignore-call */ 
12
                   getOpzionitabellaCampiExtra($campo, $modellocolonna, $opzionibuilder);
Loading history...
12
            foreach ($modellocolonna as $key => $value) {
13
                if (!array_key_exists($campo, $opzionibuilder)) {
14
                    if ((isset($modellocolonna['campoextra']) && true == $modellocolonna['campoextra'])) {
0 ignored issues
show
Unused Code introduced by
This if statement is empty and can be removed.

This check looks for the bodies of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These if bodies can be removed. If you have an empty if but statements in the else branch, consider inverting the condition.

if (rand(1, 6) > 3) {
//print "Check failed";
} else {
    print "Check succeeded";
}

could be turned into

if (rand(1, 6) <= 3) {
    print "Check succeeded";
}

This is much more concise to read.

Loading history...
15
                        // tuttapposto
16
                    } else {
17
                        $ex = 'Fifree: '.$campo." field table option not found, did you mean one of these:\n".
18
                                implode("\n", array_keys($opzionibuilder)).
19
                                ' ?';
20
                        throw new \Exception($ex);
21
                    }
22
                }
23
                if ('ordine' == $key) {
24
                    $this->setMaxOrdine($value);
0 ignored issues
show
Bug introduced by
It seems like setMaxOrdine() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
                    $this->/** @scrutinizer ignore-call */ 
25
                           setMaxOrdine($value);
Loading history...
25
                }
26
                $opzionibuilder[$campo][$key] = $value;
27
            }
28
        }
29
    }
30
}
31