Completed
Push — master ( d8d861...a71811 )
by Roberto
04:01 queued 14s
created

TraitBlocoVII   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 284
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 284
ccs 0
cts 267
cp 0
rs 10
c 0
b 0
f 0
wmc 9
lcom 1
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
C blocoVII() 0 281 9
1
<?php
2
namespace NFePHP\DA\NFe\Traits;
3
4
/**
5
 * Bloco VII informações do consumidor e dados da NFCe
6
 */
7
trait TraitBlocoVII
8
{
9
    protected function blocoVII($y)
10
    {
11
        $nome = $this->getTagValue($this->dest, "xNome");
0 ignored issues
show
Bug introduced by
The property dest does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
12
        $cnpj = $this->getTagValue($this->dest, "CNPJ");
0 ignored issues
show
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
13
        $cpf = $this->getTagValue($this->dest, "CPF");
0 ignored issues
show
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
14
        $rua = $this->getTagValue($this->enderDest, "xLgr");
0 ignored issues
show
Bug introduced by
The property enderDest does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
15
        $numero = $this->getTagValue($this->enderDest, "nro");
0 ignored issues
show
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
16
        $complemento = $this->getTagValue($this->enderDest, "xCpl");
0 ignored issues
show
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
17
        $bairro = $this->getTagValue($this->enderDest, "xBairro");
0 ignored issues
show
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
18
        $mun = $this->getTagValue($this->enderDest, "xMun");
0 ignored issues
show
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
19
        $uf = $this->getTagValue($this->enderDest, "UF");
0 ignored issues
show
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
20
        $texto = '';
0 ignored issues
show
Unused Code introduced by
$texto is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
21
        $yPlus = 0;
22
        if (!empty($cnpj)) {
23
            $texto = "CONSUMIDOR - CNPJ "
24
                . $this->formatField($cnpj, "##.###.###/####-##") . " - " . $nome;
0 ignored issues
show
Bug introduced by
It seems like formatField() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
25
            $texto .= "\n {$rua}, {$numero} {$complemento} {$bairro} {$mun}-{$uf}";
26
        } elseif (!empty($cpf)) {
27
            $texto = "CONSUMIDOR - CPF "
28
                . $this->formatField($cpf, "###.###.###-##") . " = " . $nome;
0 ignored issues
show
Bug introduced by
It seems like formatField() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
29
            $texto .= "\n {$rua}, {$numero} {$complemento} {$bairro} {$mun}-{$uf}";
30
        } else {
31
            $texto = 'CONSUMIDOR NÃO IDENTIFICADO';
32
            $yPlus = 1;
33
        }
34
        if ($this->getTagValue($this->nfeProc, "xMsg")) {
0 ignored issues
show
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
35
            $texto .= "\n {$this->getTagValue($this->nfeProc, "xMsg")}";
0 ignored issues
show
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
Bug introduced by
The property nfeProc does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
36
            $this->bloco7H += 4;
0 ignored issues
show
Bug introduced by
The property bloco7H does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
37
        }
38
        $subSize = 0;
39
        if ($this->paperwidth < 70) {
0 ignored issues
show
Bug introduced by
The property paperwidth does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
40
            $subSize = 1.5;
41
        }
42
        if ($this->tpEmis == 9) {
43
            $aFont = ['font'=> $this->fontePadrao, 'size' => (7-$subSize), 'style' => ''];
0 ignored issues
show
Bug introduced by
The property fontePadrao does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
44
            $y += 2*$yPlus;
45
            $y1 = $this->pdf->textBox(
0 ignored issues
show
Bug introduced by
The property pdf does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
46
                $this->margem,
0 ignored issues
show
Bug introduced by
The property margem does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
47
                $y,
48
                $this->wPrint,
0 ignored issues
show
Bug introduced by
The property wPrint does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
49
                $this->bloco7H,
50
                $texto,
51
                $aFont,
52
                'T',
53
                'C',
54
                false,
55
                '',
56
                false
57
            );
58
        
59
            $y1 += 2*$yPlus;
60
            $num = str_pad($this->getTagValue($this->ide, "nNF"), 9, '0', STR_PAD_LEFT);
0 ignored issues
show
Bug introduced by
The property ide does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
61
            $serie = str_pad($this->getTagValue($this->ide, "serie"), 3, '0', STR_PAD_LEFT);
0 ignored issues
show
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
62
            $data = (new \DateTime($this->getTagValue($this->ide, "dhEmi")))->format('d/m/Y H:i:s');
0 ignored issues
show
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
63
            $texto = "NFCe n. {$num} Série {$serie} {$data}";
64
            $aFont = ['font'=> $this->fontePadrao, 'size' => 8, 'style' => 'B'];
65
            $y2 = $this->pdf->textBox(
66
                $this->margem,
67
                $y+$y1,
68
                $this->wPrint,
69
                4,
70
                $texto,
71
                $aFont,
72
                'T',
73
                'C',
74
                false,
75
                '',
76
                true
77
            );
78
79
            $texto = $this->via;
0 ignored issues
show
Bug introduced by
The property via does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
80
            $y3 = $this->pdf->textBox(
81
                $this->margem,
82
                $y+$y1+$y2,
83
                $this->wPrint,
84
                4,
85
                $texto,
86
                $aFont,
87
                'T',
88
                'C',
89
                false,
90
                '',
91
                true
92
            );
93
            
94
            //contingencia offline
95
            $texto = "EMITIDA EM CONTINGÊNCIA";
96
            $aFont = ['font'=> $this->fontePadrao, 'size' => 10, 'style' => 'B'];
97
            $y4 = $this->pdf->textBox(
98
                $this->margem,
99
                $y+$y1+$y2+$y3,
100
                $this->wPrint,
101
                4,
102
                $texto,
103
                $aFont,
104
                'B',
105
                'C',
106
                false,
107
                '',
108
                true
109
            );
110
            
111
            $texto = "Pendente de autorização";
112
            $aFont = ['font'=> $this->fontePadrao, 'size' => 8, 'style' => 'I'];
113
            $y5 = $this->pdf->textBox(
0 ignored issues
show
Unused Code introduced by
$y5 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
114
                $this->margem,
115
                $y+$y1+$y2+$y3+$y4,
116
                $this->wPrint,
117
                3,
118
                $texto,
119
                $aFont,
120
                'B',
121
                'C',
122
                false,
123
                '',
124
                true
125
            );
126
        } elseif ($this->tpEmis == 4) {
0 ignored issues
show
Bug introduced by
The property tpEmis does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
127
            
128
            $aFont = ['font'=> $this->fontePadrao, 'size' => 7, 'style' => ''];
129
            $y1 = $this->pdf->textBox(
130
                $this->margem,
131
                $y+1,
132
                $this->wPrint,
133
                $this->bloco7H,
134
                $texto,
135
                $aFont,
136
                'T',
137
                'C',
138
                false,
139
                '',
140
                false
141
            );
142
        
143
            $num = str_pad($this->getTagValue($this->ide, "nNF"), 9, '0', STR_PAD_LEFT);
0 ignored issues
show
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
144
            $serie = str_pad($this->getTagValue($this->ide, "serie"), 3, '0', STR_PAD_LEFT);
0 ignored issues
show
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
145
            $data = (new \DateTime($this->getTagValue($this->ide, "dhEmi")))->format('d/m/Y H:i:s');
0 ignored issues
show
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
146
            $texto = "NFCe n. {$num} Série {$serie} {$data}";
147
            $aFont = ['font'=> $this->fontePadrao, 'size' => (8-$subSize), 'style' => ''];
148
            $y2 = $this->pdf->textBox(
0 ignored issues
show
Unused Code introduced by
$y2 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
149
                $this->margem,
150
                $y+1+$y1,
151
                $this->wPrint,
152
                4,
153
                $texto,
154
                $aFont,
155
                'T',
156
                'C',
157
                false,
158
                '',
159
                true
160
            );
161
            $texto = "DANFE-NFC-e Impresso em contingência - EPEC";
162
            $aFont = ['font'=> $this->fontePadrao, 'size' => (10-$subSize), 'style' => 'B'];
163
            $y2 = $this->pdf->textBox(
164
                $this->margem,
165
                $y+1+$y1+3,
166
                $this->wPrint,
167
                4,
168
                $texto,
169
                $aFont,
170
                'T',
171
                'C',
172
                false,
173
                '',
174
                true
175
            );
176
            
177
            $texto = "Regularmente recebido pela administração tributária autorizadora";
178
            $aFont = ['font'=> $this->fontePadrao, 'size' => (8-$subSize), 'style' => ''];
179
            $y2 = $this->pdf->textBox(
180
                $this->margem,
181
                $y+1+$y1+$y2+3,
182
                $this->wPrint,
183
                4,
184
                $texto,
185
                $aFont,
186
                'T',
187
                'C',
188
                false,
189
                '',
190
                true
191
            );
192
            if (!empty($this->dom->getElementsByTagName('dhCont'))) {
193
                $dhCont = $this->dom->getElementsByTagName('dhCont')->item(0)->nodeValue;
0 ignored issues
show
Bug introduced by
The property dom does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
194
                $dt = \DateTime::createFromFormat('Y-m-d\TH:i:sP', $dhCont);
195
                $texto = "Data de entrada em contingência : " . $dt->format('d/m/Y H:i:s'); 
196
                $aFont = ['font'=> $this->fontePadrao, 'size' => (7-$subSize), 'style' => ''];
197
                $y2 = $this->pdf->textBox(
0 ignored issues
show
Unused Code introduced by
$y2 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
198
                    $this->margem,
199
                    $y+1+$y1+$y2+6,
200
                    $this->wPrint,
201
                    4,
202
                    $texto,
203
                    $aFont,
204
                    'B',
205
                    'C',
206
                    false,
207
                    '',
208
                    true
209
                );
210
            }    
211
            
212
            
213
        } else {
214
            $aFont = ['font'=> $this->fontePadrao, 'size' => 7, 'style' => ''];
215
            $y1 = $this->pdf->textBox(
216
                $this->margem,
217
                $y+1,
218
                $this->wPrint,
219
                $this->bloco7H,
220
                $texto,
221
                $aFont,
222
                'T',
223
                'C',
224
                false,
225
                '',
226
                false
227
            );
228
        
229
            $num = str_pad($this->getTagValue($this->ide, "nNF"), 9, '0', STR_PAD_LEFT);
0 ignored issues
show
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
230
            $serie = str_pad($this->getTagValue($this->ide, "serie"), 3, '0', STR_PAD_LEFT);
0 ignored issues
show
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
231
            $data = (new \DateTime($this->getTagValue($this->ide, "dhEmi")))->format('d/m/Y H:i:s');
0 ignored issues
show
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
232
            $texto = "NFCe n. {$num} Série {$serie} {$data}";
233
            $aFont = ['font'=> $this->fontePadrao, 'size' => (8-$subSize), 'style' => 'B'];
234
            $y2 = $this->pdf->textBox(
235
                $this->margem,
236
                $y+1+$y1,
237
                $this->wPrint,
238
                4,
239
                $texto,
240
                $aFont,
241
                'T',
242
                'C',
243
                false,
244
                '',
245
                true
246
            );
247
248
            $protocolo = '';
249
            $data = '';
250
            if (!empty($this->nfeProc)) {
251
                $protocolo = $this->formatField($this->getTagValue($this->nfeProc, 'nProt'), '### ########## ##');
0 ignored issues
show
Bug introduced by
It seems like formatField() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
252
                $data = (new \DateTime($this->getTagValue($this->nfeProc, "dhRecbto")))->format('d/m/Y H:i:s');
0 ignored issues
show
Bug introduced by
It seems like getTagValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
253
            }
254
            
255
            $texto = "Protocolo de Autorização:  {$protocolo}";
256
            $aFont = ['font'=> $this->fontePadrao, 'size' => (8-$subSize), 'style' => ''];
257
            $y3 = $this->pdf->textBox(
258
                $this->margem,
259
                $y+1+$y1+$y2,
260
                $this->wPrint,
261
                4,
262
                $texto,
263
                $aFont,
264
                'T',
265
                'C',
266
                false,
267
                '',
268
                true
269
            );
270
            
271
            $texto = "Data de Autorização:  {$data}";
272
            $aFont = ['font'=> $this->fontePadrao, 'size' => (8-$subSize), 'style' => ''];
273
            $y4 = $this->pdf->textBox(
0 ignored issues
show
Unused Code introduced by
$y4 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
274
                $this->margem,
275
                $y+1+$y1+$y2+$y3,
276
                $this->wPrint,
277
                4,
278
                $texto,
279
                $aFont,
280
                'T',
281
                'C',
282
                false,
283
                '',
284
                true
285
            );
286
        }
287
        $this->pdf->dashedHLine($this->margem, $this->bloco7H+$y, $this->wPrint, 0.1, 30);
288
        return $this->bloco7H + $y;
289
    }
290
}
291