Passed
Push — master ( cbb0fa...beaba6 )
by Roberto
04:17 queued 01:29
created

Danfe   F

Complexity

Total Complexity 433

Size/Duplication

Total Lines 3840
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 3840
ccs 0
cts 2865
cp 0
rs 0.8
c 0
b 0
f 0
wmc 433
lcom 1
cbo 3

34 Methods

Rating   Name   Duplication   Size   Complexity  
A obsContShow() 0 4 1
A setVUnComCasasDec() 0 4 1
A setQComCasasDec() 0 4 1
A __construct() 0 4 1
A epec() 0 7 1
A setOcultarUnidadeTributavel() 0 4 1
F calculoEspacoVericalDadosAdicionais() 0 85 21
F monta() 0 281 45
F anfaveaDANFE() 0 143 37
D statusNFe() 0 54 19
F header() 0 383 31
F destinatarioDANFE() 0 203 22
F localEntregaDANFE() 0 141 12
F localRetiradaDANFE() 0 141 12
B getTextoFatura() 0 30 7
A sizeExtraTextoFatura() 0 10 3
F fatura() 0 116 20
F pagamento() 0 120 14
A impostoHelper() 0 20 3
B imposto() 0 66 8
F transporte() 0 313 52
A descricaoProdutoHelper() 0 15 4
F descricaoProduto() 0 78 12
F itens() 0 380 36
B dadosItenVeiculoDANFE() 0 161 3
D issqn() 0 71 11
B dadosAdicionais() 0 74 9
A rodape() 0 16 3
C canhoto() 0 136 9
B geraInformacoesDaTagCompra() 0 20 6
B geraChaveAdicionalDeContingencia() 0 33 6
C geraInformacoesDasNotasReferenciadas() 0 84 14
A loadDoc() 0 38 4
A calculeHeight() 0 18 4

How to fix   Complexity   

Complex Class

Complex classes like Danfe often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use Danfe, and based on these observations, apply Extract Interface, too.

1
<?php
2
namespace NFePHP\DA\NFe;
3
4
use NFePHP\DA\Legacy\Dom;
5
use NFePHP\DA\Legacy\Pdf;
6
use \NFePHP\DA\Common\DaCommon;
7
8
class Danfe extends DaCommon
9
{
10
11
    /**
12
     * Posição
13
     *
14
     * @var float
15
     */
16
    protected $yDados = 0;
17
    /**
18
     * Parâmetro para exibir ou ocultar os valores do PIS/COFINS.
19
     *
20
     * @var boolean
21
     */
22
    protected $qCanhoto = 1;
23
    /**
24
     * Define a exbição dos valores de PIS e Cofins
25
     *
26
     * @var bool
27
     */
28
    protected $exibirPIS = true;
29
    /**
30
     * Parâmetro para exibir ou ocultar os valores do ICMS Interestadual e Valor Total dos Impostos.
31
     *
32
     * @var boolean
33
     */
34
    protected $exibirIcmsInterestadual = true;
35
    /**
36
     * Parâmetro para exibir ou ocultar o texto sobre valor aproximado dos tributos.
37
     *
38
     * @var boolean
39
     */
40
    protected $exibirValorTributos = true;
41
    /**
42
     * Parâmetro para exibir ou ocultar o texto adicional sobre a forma de pagamento
43
     * e as informações de fatura/duplicata.
44
     *
45
     * @var boolean
46
     */
47
    protected $exibirTextoFatura = false;
48
    /**
49
     * Parâmetro do controle se deve concatenar automaticamente informações complementares
50
     * na descrição do produto, como por exemplo, informações sobre impostos.
51
     *
52
     * @var boolean
53
     */
54
    public $descProdInfoComplemento = true;
55
    /**
56
     *`Parâmetro que habilita a geração de automatica de informações
57
     *
58
     * @var boolean
59
     */
60
    public $gerarInformacoesAutomaticas = true;
61
    /**
62
     * Parâmetro do controle se deve gerar quebras de linha com "\n" a partir de ";" na descrição do produto.
63
     *
64
     * @var boolean
65
     */
66
    protected $descProdQuebraLinha = true;
67
     /**
68
     * Parâmetro para ocultar a unidade tributável nos itens
69
     *
70
     * @var boolean
71
     */
72
    protected $ocultarUnidadeTributavel = false;
73
    /**
74
     * XML NFe
75
     *
76
     * @var string
77
     */
78
    protected $xml;
79
    /**
80
     * mesagens de erro
81
     *
82
     * @var string
83
     */
84
    protected $errMsg = '';
85
    /**
86
     * status de erro true um erro ocorreu false sem erros
87
     *
88
     * @var boolean
89
     */
90
    protected $errStatus = false;
91
    /**
92
     * Texto adicional da DANFE
93
     *
94
     * @var string
95
     */
96
    protected $textoAdic = '';
97
    /**
98
     * Largura
99
     *
100
     * @var float
101
     */
102
    protected $wAdic = 0;
103
    /**
104
     * largura do canhoto (25mm) apenas para a formatação paisagem
105
     *
106
     * @var float
107
     */
108
    protected $wCanhoto = 25;
109
    /**
110
     * Formato chave
111
     *
112
     * @var string
113
     */
114
    protected $formatoChave = "#### #### #### #### #### #### #### #### #### #### ####";
115
    /**
116
     * quantidade de itens já processados na montagem do DANFE
117
     *
118
     * @var integer
119
     */
120
    protected $qtdeItensProc;
121
    /**
122
     * Dom Document
123
     *
124
     * @var \NFePHP\DA\Legacy\Dom
125
     */
126
    protected $dom;
127
    /**
128
     * Node
129
     *
130
     * @var \DOMNode
131
     */
132
    protected $infNFe;
133
    /**
134
     * Node
135
     *
136
     * @var \DOMNode
137
     */
138
    protected $ide;
139
    /**
140
     * Node
141
     *
142
     * @var \DOMNode
143
     */
144
    protected $entrega;
145
    /**
146
     * Node
147
     *
148
     * @var \DOMNode
149
     */
150
    protected $retirada;
151
    /**
152
     * Node
153
     *
154
     * @var \DOMNode
155
     */
156
    protected $emit;
157
    /**
158
     * Node
159
     *
160
     * @var \DOMNode
161
     */
162
    protected $dest;
163
    /**
164
     * Node
165
     *
166
     * @var \DOMNode
167
     */
168
    protected $enderEmit;
169
    /**
170
     * Node
171
     *
172
     * @var \DOMNode
173
     */
174
    protected $enderDest;
175
    /**
176
     * Node
177
     *
178
     * @var \DOMNode
179
     */
180
    protected $det;
181
    /**
182
     * Node
183
     *
184
     * @var \DOMNode
185
     */
186
    protected $cobr;
187
    /**
188
     * Node
189
     *
190
     * @var \DOMNode
191
     */
192
    protected $dup;
193
    /**
194
     * Node
195
     *
196
     * @var \DOMNode
197
     */
198
    protected $ICMSTot;
199
    /**
200
     * Node
201
     *
202
     * @var \DOMNode
203
     */
204
    protected $ISSQNtot;
205
    /**
206
     * Node
207
     *
208
     * @var \DOMNode
209
     */
210
    protected $transp;
211
    /**
212
     * Node
213
     *
214
     * @var \DOMNode
215
     */
216
    protected $transporta;
217
    /**
218
     * Node
219
     *
220
     * @var \DOMNode
221
     */
222
    protected $veicTransp;
223
    /**
224
     * Node reboque
225
     *
226
     * @var \DOMNode
227
     */
228
    protected $reboque;
229
    /**
230
     * Node infAdic
231
     *
232
     * @var \DOMNode
233
     */
234
    protected $infAdic;
235
    /**
236
     * Tipo de emissão
237
     *
238
     * @var integer
239
     */
240
    protected $tpEmis;
241
    /**
242
     * Node infProt
243
     *
244
     * @var \DOMNode
245
     */
246
    protected $infProt;
247
    /**
248
     * 1-Retrato/ 2-Paisagem
249
     *
250
     * @var integer
251
     */
252
    protected $tpImp;
253
    /**
254
     * Node compra
255
     *
256
     * @var \DOMNode
257
     */
258
    protected $compra;
259
    /**
260
     * @var int
261
     */
262
    protected $textadicfontsize;
263
    /**
264
     * Número de casas para a quantidade de itens da unidade comercial.
265
     *
266
     * @var integer
267
     */
268
    protected $qComCasasDec = 4;
269
    /**
270
     * Número de casas decimais para o valor da unidade comercial.
271
     *
272
     * @var integer
273
     */
274
    protected $vUnComCasasDec = 4;
275
    /**
276
     * @var int
277
     */
278
    protected $hdadosadic = 10;
279
    /**
280
     * @var array
281
     */
282
    protected $epec = [];
283
    /**
284
     * @var bool
285
     */
286
    protected $obsshow = true;
287
288
    /**
289
     * __construct
290
     *
291
     * @name  __construct
292
     *
293
     * @param string $xml Conteúdo XML da NF-e (com ou sem a tag nfeProc)
294
     */
295
    public function __construct($xml)
296
    {
297
        $this->loadDoc($xml);
298
    }
299
300
    public function epec($protocolo, $data)
301
    {
302
        $this->epec = [
303
            'protocolo' => $protocolo,
304
            'data' => $data
305
        ];
306
    }
307
308
    public function obsContShow($flag = true)
309
    {
310
        $this->obsshow = $flag;
311
    }
312
313
    /**
314
     * Define a quantidade de casas decimais para unidade comercial.
315
     *
316
     * @param integer $vUnComCasasDec
317
     */
318
    public function setVUnComCasasDec($vUnComCasasDec)
319
    {
320
        $this->vUnComCasasDec = $vUnComCasasDec;
321
    }
322
323
    /**
324
     * Define a quantidade de casas decimais para unidade comercial.
325
     *
326
     * @param integer $qComCasasDec
327
     */
328
    public function setQComCasasDec($qComCasasDec)
329
    {
330
        $this->qComCasasDec = $qComCasasDec;
331
    }
332
333
    /**
334
     * Atribui se a unidade tributável deve sempre ocultada nos itens.
335
     * @param bool $ocultarUnidadeTributavel
336
     */
337
    public function setOcultarUnidadeTributavel($ocultarUnidadeTributavel = false)
338
    {
339
        $this->ocultarUnidadeTributavel = filter_var($ocultarUnidadeTributavel, FILTER_VALIDATE_BOOLEAN);
340
    }
341
342
    protected function calculoEspacoVericalDadosAdicionais()
343
    {
344
        $this->textoAdic = '';
345
        //informações adicionais
346
        $fontProduto            = [
347
            'font'  => $this->fontePadrao,
348
            'size'  => 8,
349
            'style' => ''
350
        ];
351
        $k                      = $this->pdf->k;
352
        $this->textadicfontsize = $fontProduto['size'] / $k;
0 ignored issues
show
Documentation Bug introduced by
It seems like $fontProduto['size'] / $k can also be of type double. However, the property $textadicfontsize is declared as type integer. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
353
        $this->textoAdic        .= $this->geraInformacoesDasNotasReferenciadas();
354
        if (isset($this->infAdic)) {
355
            $i = 0;
356
            if ($this->textoAdic != '') {
357
                $this->textoAdic .= ". \n";
358
            }
359
            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infCpl"))
360
                ? 'Inf. Contribuinte: ' . $this->anfaveaDANFE($this->getTagValue($this->infAdic, "infCpl"))
361
                : '';
362
            $infPedido       = $this->geraInformacoesDaTagCompra();
363
            if ($infPedido != "") {
364
                $this->textoAdic .= $infPedido;
365
            }
366
            $this->textoAdic .= $this->getTagValue($this->dest, "email", ' Email do Destinatário: ');
367
            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infAdFisco"))
368
                ? "\n Inf. fisco: " . $this->getTagValue($this->infAdic, "infAdFisco")
369
                : '';
370
            if ($this->obsshow) {
371
                $obsCont = $this->infAdic->getElementsByTagName("obsCont");
372
                if (isset($obsCont)) {
373
                    foreach ($obsCont as $obs) {
374
                        $campo = $obsCont->item($i)->getAttribute("xCampo");
375
                        $xTexto = ! empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue)
376
                            ? $obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue
377
                            : '';
378
                        $this->textoAdic .= "\n" . $campo . ':  ' . trim($xTexto);
379
                        $i ++;
380
                    }
381
                }
382
            }
383
        }
384
        //INCLUSO pela NT 2013.003 Lei da Transparência
385
        //verificar se a informação sobre o valor aproximado dos tributos
386
        //já se encontra no campo de informações adicionais
387
        if ($this->exibirValorTributos) {
388
            $flagVTT  = strpos(strtolower(trim($this->textoAdic)), 'valor');
389
            $flagVTT  = $flagVTT || strpos(strtolower(trim($this->textoAdic)), 'vl');
390
            $flagVTT  = $flagVTT && strpos(strtolower(trim($this->textoAdic)), 'aprox');
391
            $flagVTT  = $flagVTT && (strpos(strtolower(trim($this->textoAdic)), 'trib') ||
392
                    strpos(strtolower(trim($this->textoAdic)), 'imp'));
393
            $vTotTrib = $this->getTagValue($this->ICMSTot, 'vTotTrib');
394
            if ($vTotTrib != '' && ! $flagVTT) {
395
                $this->textoAdic .= "\n Valor Aproximado dos Tributos : R$ "
396
                    . number_format($vTotTrib, 2, ",", ".");
397
            }
398
        }
399
        //fim da alteração NT 2013.003 Lei da Transparência
400
        $this->textoAdic        = str_replace(";", "\n", $this->textoAdic);
401
        $numlinhasdados         = $this->pdf->getNumLines($this->textoAdic, $this->wAdic, $fontProduto) + 1.5;
402
        $this->textadicfontsize = $this->pdf->fontSize;
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->pdf->fontSize can also be of type double. However, the property $textadicfontsize is declared as type integer. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
403
        $hdadosadic             = ceil($numlinhasdados * ($this->textadicfontsize));
404
        if ($hdadosadic > 70) {
405
            for ($f = 8; $f > 3; $f --) {
406
                $this->pdf->setFont($this->fontePadrao, '', $f);
407
                $fontProduto            = [
408
                    'font'  => $this->fontePadrao,
409
                    'size'  => $f,
410
                    'style' => ''
411
                ];
412
                $numlinhasdados         = $this->pdf->getNumLines($this->textoAdic, $this->wAdic, $fontProduto) + 3;
413
                $this->textadicfontsize = $this->pdf->fontSize;
414
                $hdadosadic             = ceil($numlinhasdados * $this->textadicfontsize);
415
                if ($hdadosadic <= 90) {
416
                    $hdadosadic = ceil($hdadosadic);
417
                    break;
418
                }
419
            }
420
        }
421
        if ($hdadosadic < 10) {
422
            $hdadosadic = 10;
423
        }
424
425
        return $hdadosadic;
426
    }
427
428
    /**
429
     * monta
430
     * Monta a DANFE conforme as informações fornecidas para a classe durante sua
431
     * construção. Constroi DANFEs com até 3 páginas podendo conter até 56 itens.
432
     * A definição de margens e posições iniciais para a impressão são estabelecidas
433
     * pelo conteúdo da funçao e podem ser modificados.
434
     *
435
     * @return string O ID da NFe numero de 44 digitos extraido do arquivo XML
436
     */
437
    protected function monta(
438
        $logo = ''
439
    ) {
440
        $this->pdf       = '';
0 ignored issues
show
Documentation Bug introduced by
It seems like '' of type string is incompatible with the declared type object<NFePHP\DA\Legacy\Pdf> of property $pdf.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
441
        $this->logomarca = $this->adjustImage($logo);
442
        //se a orientação estiver em branco utilizar o padrão estabelecido na NF
443
        if (empty($this->orientacao)) {
444
            if ($this->tpImp == '2') {
445
                $this->orientacao = 'L';
446
            } else {
447
                $this->orientacao = 'P';
448
            }
449
        }
450
        //instancia a classe pdf
451
        $this->pdf = new Pdf($this->orientacao, 'mm', $this->papel);
0 ignored issues
show
Bug introduced by
It seems like $this->papel can also be of type array; however, NFePHP\DA\Legacy\Pdf::__construct() does only seem to accept string, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
452
        //margens do PDF, em milímetros. Obs.: a margem direita é sempre igual à
453
        //margem esquerda. A margem inferior *não* existe na FPDF, é definida aqui
454
        //apenas para controle se necessário ser maior do que a margem superior
455
        // posição inicial do conteúdo, a partir do canto superior esquerdo da página
456
        $xInic = $this->margesq;
457
        if ($this->orientacao == 'P') {
458
            if ($this->papel == 'A4') {
459
                $this->maxW = 210;
0 ignored issues
show
Documentation Bug introduced by
The property $maxW was declared of type double, but 210 is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
460
                $this->maxH = 297;
0 ignored issues
show
Documentation Bug introduced by
The property $maxH was declared of type double, but 297 is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
461
            }
462
        } else {
463
            if ($this->papel == 'A4') {
464
                $this->maxW = 297;
0 ignored issues
show
Documentation Bug introduced by
The property $maxW was declared of type double, but 297 is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
465
                $this->maxH = 210;
0 ignored issues
show
Documentation Bug introduced by
The property $maxH was declared of type double, but 210 is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
466
                $xInic      = $this->margesq + 10;
467
                //se paisagem multiplica a largura do canhoto pela quantidade de canhotos
468
                //$this->wCanhoto *= $this->qCanhoto;
469
            }
470
        }
471
        //total inicial de paginas
472
        $totPag = 1;
0 ignored issues
show
Unused Code introduced by
$totPag 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...
473
        //largura imprimivel em mm: largura da folha menos as margens esq/direita
474
        $this->wPrint = $this->maxW - ($this->margesq * 2);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->maxW - $this->margesq * 2 can also be of type integer. However, the property $wPrint is declared as type double. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
475
        //comprimento (altura) imprimivel em mm: altura da folha menos as margens
476
        //superior e inferior
477
        $this->hPrint = $this->maxH - $this->margsup - $this->marginf;
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->maxH - $this->margsup - $this->marginf can also be of type integer. However, the property $hPrint is declared as type double. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
478
        // estabelece contagem de paginas
479
        $this->pdf->aliasNbPages();
480
        // fixa as margens
481
        $this->pdf->setMargins($this->margesq, $this->margsup);
482
        $this->pdf->setDrawColor(0, 0, 0);
483
        $this->pdf->setFillColor(255, 255, 255);
484
        // inicia o documento
485
        $this->pdf->open();
486
        // adiciona a primeira página
487
        $this->pdf->addPage($this->orientacao, $this->papel);
0 ignored issues
show
Bug introduced by
It seems like $this->papel can also be of type array; however, NFePHP\DA\Legacy\FPDF\Fpdf::addPage() does only seem to accept string, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
488
        $this->pdf->setLineWidth(0.1);
489
        $this->pdf->settextcolor(0, 0, 0);
490
491
        //##################################################################
492
        // CALCULO DO NUMERO DE PAGINAS A SEREM IMPRESSAS
493
        //##################################################################
494
        //Verificando quantas linhas serão usadas para impressão das duplicatas
495
        $linhasDup = 0;
496
        $qtdPag    = 0;
497
        if (isset($this->dup) && $this->dup->length > 0) {
498
            $qtdPag = $this->dup->length;
0 ignored issues
show
Bug introduced by
The property length does not seem to exist in DOMNode.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
499
        } elseif (isset($this->detPag) && $this->detPag->length > 0) {
0 ignored issues
show
Bug introduced by
The property detPag 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...
500
            $qtdPag = $this->detPag->length;
501
        }
502
        if (($qtdPag > 0) && ($qtdPag <= 7)) {
503
            $linhasDup = 1;
504
        } elseif (($qtdPag > 7) && ($qtdPag <= 14)) {
505
            $linhasDup = 2;
506
        } elseif (($qtdPag > 14) && ($qtdPag <= 21)) {
507
            $linhasDup = 3;
508
        } elseif ($qtdPag > 21) {
509
            // chinnonsantos 11/05/2016: Limite máximo de impressão de duplicatas na NFe,
510
            // só vai ser exibito as 21 primeiras duplicatas (parcelas de pagamento),
511
            // se não oculpa espaço d+, cada linha comporta até 7 duplicatas.
512
            $linhasDup = 3;
513
        }
514
        //verifica se será impressa a linha dos serviços ISSQN
515
        $linhaISSQN = 0;
516
        if ((isset($this->ISSQNtot)) && ($this->getTagValue($this->ISSQNtot, 'vServ') > 0)) {
517
            $linhaISSQN = 1;
518
        }
519
        //calcular a altura necessária para os dados adicionais
520
        if ($this->orientacao == 'P') {
521
            $this->wAdic = round($this->wPrint * 0.66, 0);
522
        } else {
523
            $this->wAdic = round(($this->wPrint - $this->wCanhoto) * 0.5, 0);
524
        }
525
        $fontProduto = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
0 ignored issues
show
Unused Code introduced by
$fontProduto 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...
526
527
        $this->hdadosadic = $this->calculoEspacoVericalDadosAdicionais();
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->calculoEspacoVericalDadosAdicionais() can also be of type double. However, the property $hdadosadic is declared as type integer. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
528
529
        //altura disponivel para os campos da DANFE
530
        $hcabecalho    = 47;//para cabeçalho
531
        $hdestinatario = 25;//para destinatario
532
        $hduplicatas   = 12;//para cada grupo de 7 duplicatas
533
        if (isset($this->entrega)) {
534
            $hlocalentrega = 25;
535
        } else {
536
            $hlocalentrega = 0;
537
        }
538
        if (isset($this->retirada)) {
539
            $hlocalretirada = 25;
540
        } else {
541
            $hlocalretirada = 0;
542
        }
543
        $himposto    = 18;// para imposto
544
        $htransporte = 25;// para transporte
545
        $hissqn      = 11;// para issqn
546
        $hfooter     = 5;// para rodape
547
        $hCabecItens = 4;//cabeçalho dos itens
548
        $hOCUPADA    = $hcabecalho
549
            + $hdestinatario
550
            + $hlocalentrega
551
            + $hlocalretirada
552
            + ($linhasDup * $hduplicatas)
553
            + $himposto + $htransporte
554
            + ($linhaISSQN * $hissqn)
555
            + $this->hdadosadic
556
            + $hfooter
557
            + $hCabecItens
558
            + $this->sizeExtraTextoFatura();
559
560
        //alturas disponiveis para os dados
561
        $hDispo1 = $this->hPrint - $hOCUPADA;
562
        /*($hcabecalho +
563
        //$hdestinatario + ($linhasDup * $hduplicatas) + $himposto + $htransporte +
564
        $hdestinatario + $hlocalentrega + $hlocalretirada +
565
        ($linhasDup * $hduplicatas) + $himposto + $htransporte +
566
        ($linhaISSQN * $hissqn) + $this->hdadosadic + $hfooter + $hCabecItens +
567
        $this->sizeExtraTextoFatura());*/
568
569
        if ($this->orientacao == 'P') {
570
            $hDispo1 -= 24 * $this->qCanhoto;//para canhoto
571
            $w       = $this->wPrint;
572
        } else {
573
            $hcanhoto = $this->hPrint;//para canhoto
0 ignored issues
show
Unused Code introduced by
$hcanhoto 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...
574
            $w        = $this->wPrint - $this->wCanhoto;
575
        }
576
        //$hDispo1 += 14;
577
        $hDispo2 = $this->hPrint - ($hcabecalho + $hfooter + $hCabecItens);
578
        //Contagem da altura ocupada para impressão dos itens
579
        $aFont     = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
0 ignored issues
show
Unused Code introduced by
$aFont 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...
580
        $numlinhas = 0;
0 ignored issues
show
Unused Code introduced by
$numlinhas 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...
581
        $hUsado    = $hCabecItens;
582
        $w2        = round($w * 0.25, 0);
0 ignored issues
show
Unused Code introduced by
$w2 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...
583
        $hDispo    = $hDispo1;
584
        $totPag    = 1;
585
        $i         = 0;
586
        while ($i < $this->det->length) {
587
            $itemProd = $this->det->item($i);
588
            $texto = $this->descricaoProduto($itemProd);
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...
589
            $mostrarUnidadeTributavel = false;
0 ignored issues
show
Unused Code introduced by
$mostrarUnidadeTributavel 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...
590
591
            $prod = $itemProd->getElementsByTagName('prod')->item(0);
592
            $uCom = $prod->getElementsByTagName("uCom")->item(0)->nodeValue;
0 ignored issues
show
Unused Code introduced by
$uCom 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...
593
            $vUnCom = $prod->getElementsByTagName("vUnCom")->item(0)->nodeValue;
594
            $uTrib = $prod->getElementsByTagName("uTrib")->item(0);
595
            $qTrib = $prod->getElementsByTagName("qTrib")->item(0);
596
            $vUnTrib = !empty($prod->getElementsByTagName("vUnTrib")->item(0)->nodeValue)
597
                ? $prod->getElementsByTagName("vUnTrib")->item(0)->nodeValue
598
                : 0;
599
            //se as unidades forem diferentes e q qtda de qTrib for maior que 0
600
            //mostrat as unidades
601
            $mostrarUnidadeTributavel = (
602
                !$this->ocultarUnidadeTributavel
603
                && !empty($uTrib)
604
                && !empty($qTrib)
605
                && number_format($vUnCom, 2, ',', '') !== number_format($vUnTrib, 2, ',', '')
606
            );
607
            $hUsado += $this->calculeHeight($itemProd, $mostrarUnidadeTributavel);
608
            if ($hUsado > $hDispo) {
609
                $totPag ++;
610
                $hDispo = $hDispo2;
611
                $hUsado = $hCabecItens;
612
                $i --; // decrementa para readicionar o item que não coube nessa pagina na outra.
613
            }
614
            $i ++;
615
        } //fim da soma das areas de itens usadas
616
        $qtdeItens = $i; //controle da quantidade de itens no DANFE
617
        //montagem da primeira página
618
        $pag = 1;
619
620
        $x = $this->margesq;
621
        $y = $this->margsup;
622
        //coloca o(s) canhoto(s) da NFe
623
        if ($this->orientacao == 'P') {
624
            $y = $this->canhoto($this->margesq, $this->margsup);
625
        } else {
626
            $this->canhoto($this->margesq, $this->margsup);
627
            $x = 25;
628
        }
629
        //coloca o cabeçalho
630
        $y = $this->header($x, $y, $pag, $totPag);
631
        //coloca os dados do destinatário
632
        $y = $this->destinatarioDANFE($x, $y + 1);
633
        //coloca os dados do local de retirada
634
        if (isset($this->retirada)) {
635
            $y = $this->localRetiradaDANFE($x, $y + 1);
636
        }
637
        //coloca os dados do local de entrega
638
        if (isset($this->entrega)) {
639
            $y = $this->localEntregaDANFE($x, $y + 1);
640
        }
641
642
        //Verifica as formas de pagamento da nota fiscal
643
        $formaPag = [];
644
        if (isset($this->detPag) && $this->detPag->length > 0) {
645
            foreach ($this->detPag as $k => $d) {
646
                $fPag            = ! empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
647
                    ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue
648
                    : '0';
649
                $formaPag[$fPag] = $fPag;
650
            }
651
        }
652
        //caso tenha boleto imprimir fatura
653
        if ($this->dup->length > 0) {
654
            $y = $this->fatura($x, $y + 1);
655
        } else {
656
            //Se somente tiver a forma de pagamento sem pagamento não imprimir nada
657
            if (count($formaPag) == '1' && isset($formaPag[90])) {
658
                $y = $y;
0 ignored issues
show
Bug introduced by
Why assign $y to itself?

This checks looks for cases where a variable has been assigned to itself.

This assignement can be removed without consequences.

Loading history...
659
            } else {
660
                //caso tenha mais de uma forma de pagamento ou seja diferente de boleto exibe a
661
                //forma de pagamento e o valor
662
                $y = $this->pagamento($x, $y + 1);
663
            }
664
        }
665
        //coloca os dados dos impostos e totais da NFe
666
        $y = $this->imposto($x, $y + 1);
667
        //coloca os dados do trasnporte
668
        $y = $this->transporte($x, $y + 1);
669
        //itens da DANFE
670
        $nInicial = 0;
671
672
        $y = $this->itens($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
673
674
        //coloca os dados do ISSQN
675
        if ($linhaISSQN == 1) {
676
            $y = $this->issqn($x, $y + 4);
677
        } else {
678
            $y += 4;
679
        }
680
        //coloca os dados adicionais da NFe
681
        $y = $this->dadosAdicionais($x, $y, $this->hdadosadic);
0 ignored issues
show
Unused Code introduced by
$y 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...
682
        //coloca o rodapé da página
683
        if ($this->orientacao == 'P') {
684
            $this->rodape($xInic);
685
        } else {
686
            $this->rodape($xInic);
687
        }
688
689
        //loop para páginas seguintes
690
        for ($n = 2; $n <= $totPag; $n ++) {
691
            // fixa as margens
692
            $this->pdf->setMargins($this->margesq, $this->margsup);
693
            //adiciona nova página
694
            $this->pdf->addPage($this->orientacao, $this->papel);
0 ignored issues
show
Bug introduced by
It seems like $this->papel can also be of type array; however, NFePHP\DA\Legacy\FPDF\Fpdf::addPage() does only seem to accept string, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
695
            //ajusta espessura das linhas
696
            $this->pdf->setLineWidth(0.1);
697
            //seta a cor do texto para petro
698
            $this->pdf->settextcolor(0, 0, 0);
699
            // posição inicial do relatorio
700
            $x = $this->margesq;
701
            $y = $this->margsup;
702
            //coloca o cabeçalho na página adicional
703
            $y = $this->header($x, $y, $n, $totPag);
704
            //coloca os itens na página adicional
705
            $y = $this->itens($x, $y + 1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
0 ignored issues
show
Unused Code introduced by
$y 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...
706
            //coloca o rodapé da página
707
            if ($this->orientacao == 'P') {
708
                $this->rodape($this->margesq);
709
            } else {
710
                $this->rodape($this->margesq);
711
            }
712
            //se estiver na última página e ainda restar itens para inserir, adiciona mais uma página
713
            if ($n == $totPag && $this->qtdeItensProc < $qtdeItens) {
714
                $totPag ++;
715
            }
716
        }
717
    }
718
719
    /**
720
     * anfavea
721
     * Função para transformar o campo cdata do padrão ANFAVEA para
722
     * texto imprimível
723
     *
724
     * @param string $cdata campo CDATA
725
     *
726
     * @return string conteúdo do campo CDATA como string
727
     */
728
    protected function anfaveaDANFE($cdata = '')
729
    {
730
        if ($cdata == '') {
731
            return '';
732
        }
733
        //remove qualquer texto antes ou depois da tag CDATA
734
        $cdata    = str_replace('<![CDATA[', '<CDATA>', $cdata);
735
        $cdata    = str_replace(']]>', '</CDATA>', $cdata);
736
        $cdata    = preg_replace('/\s\s+/', ' ', $cdata);
737
        $cdata    = str_replace("> <", "><", $cdata);
738
        $len      = strlen($cdata);
739
        $startPos = strpos($cdata, '<');
740
        if ($startPos === false) {
741
            return $cdata;
742
        }
743
        for ($x = $len; $x > 0; $x --) {
744
            if (substr($cdata, $x, 1) == '>') {
745
                $endPos = $x;
746
                break;
747
            }
748
        }
749
        if ($x === 0) {
750
            return $cdata;
751
        }
752
        if ($startPos > 0) {
753
            $parte1 = substr($cdata, 0, $startPos);
754
        } else {
755
            $parte1 = '';
756
        }
757
        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
0 ignored issues
show
Bug introduced by
The variable $endPos does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
758
        if ($endPos < $len) {
759
            $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
760
        } else {
761
            $parte3 = '';
762
        }
763
        $texto = trim($parte1) . ' ' . trim($parte3);
764
        if (strpos($parte2, '<CDATA>') === false) {
765
            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
766
        } else {
767
            $cdata = $parte2;
768
        }
769
        //Retira a tag <FONTE IBPT> (caso existir) pois não é uma estrutura válida XML
770
        $cdata = str_replace('<FONTE IBPT>', '', $cdata);
771
        //carrega o xml CDATA em um objeto DOM
772
        $dom = new Dom();
773
        $dom->loadXML($cdata, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG);
774
        //$xml = $dom->saveXML();
775
        //grupo CDATA infADprod
776
        $id   = $dom->getElementsByTagName('id')->item(0);
777
        $div  = $dom->getElementsByTagName('div')->item(0);
778
        $entg = $dom->getElementsByTagName('entg')->item(0);
779
        $dest = $dom->getElementsByTagName('dest')->item(0);
780
        $ctl  = $dom->getElementsByTagName('ctl')->item(0);
781
        $ref  = $dom->getElementsByTagName('ref')->item(0);
782
        if (isset($id)) {
783
            if ($id->hasAttributes()) {
784
                foreach ($id->attributes as $attr) {
785
                    $name  = $attr->nodeName;
786
                    $value = $attr->nodeValue;
787
                    $texto .= " $name : $value";
788
                }
789
            }
790
        }
791
        if (isset($div)) {
792
            if ($div->hasAttributes()) {
793
                foreach ($div->attributes as $attr) {
794
                    $name  = $attr->nodeName;
795
                    $value = $attr->nodeValue;
796
                    $texto .= " $name : $value";
797
                }
798
            }
799
        }
800
        if (isset($entg)) {
801
            if ($entg->hasAttributes()) {
802
                foreach ($entg->attributes as $attr) {
803
                    $name  = $attr->nodeName;
804
                    $value = $attr->nodeValue;
805
                    $texto .= " $name : $value";
806
                }
807
            }
808
        }
809
        if (isset($dest)) {
810
            if ($dest->hasAttributes()) {
811
                foreach ($dest->attributes as $attr) {
812
                    $name  = $attr->nodeName;
813
                    $value = $attr->nodeValue;
814
                    $texto .= " $name : $value";
815
                }
816
            }
817
        }
818
        if (isset($ctl)) {
819
            if ($ctl->hasAttributes()) {
820
                foreach ($ctl->attributes as $attr) {
821
                    $name  = $attr->nodeName;
822
                    $value = $attr->nodeValue;
823
                    $texto .= " $name : $value";
824
                }
825
            }
826
        }
827
        if (isset($ref)) {
828
            if ($ref->hasAttributes()) {
829
                foreach ($ref->attributes as $attr) {
830
                    $name  = $attr->nodeName;
831
                    $value = $attr->nodeValue;
832
                    $texto .= " $name : $value";
833
                }
834
            }
835
        }
836
        //grupo CADATA infCpl
837
        $t          = $dom->getElementsByTagName('transmissor')->item(0);
838
        $r          = $dom->getElementsByTagName('receptor')->item(0);
839
        $versao     = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
840
            'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
841
        $especieNF  = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
842
            'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
843
        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
844
            'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
845
        $dca        = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
846
            'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
847
        $texto      .= "" . $versao . $especieNF . $fabEntrega . $dca;
848
        if (isset($t)) {
849
            if ($t->hasAttributes()) {
850
                $texto .= " Transmissor ";
851
                foreach ($t->attributes as $attr) {
852
                    $name  = $attr->nodeName;
853
                    $value = $attr->nodeValue;
854
                    $texto .= " $name : $value";
855
                }
856
            }
857
        }
858
        if (isset($r)) {
859
            if ($r->hasAttributes()) {
860
                $texto .= " Receptor ";
861
                foreach ($r->attributes as $attr) {
862
                    $name  = $attr->nodeName;
863
                    $value = $attr->nodeValue;
864
                    $texto .= " $name : $value";
865
                }
866
            }
867
        }
868
869
        return $texto;
870
    }
871
872
    /**
873
     * Verifica o status da NFe
874
     *
875
     * @return array
876
     */
877
    protected function statusNFe()
878
    {
879
        $resp = [
880
            'status' => true,
881
            'message' => [],
882
            'submessage' => ''
883
        ];
884
        if (!empty($this->epec) && $this->tpEmis == '4') {
885
            return $resp;
886
        }
887
        if (!isset($this->nfeProc)) {
888
            $resp['status'] = false;
889
            $resp['message'][] = 'NFe NÃO PROTOCOLADA';
890
        } else {
891
            if ($this->getTagValue($this->ide, "tpAmb") == '2') {
892
                $resp['status'] = false;
893
                $resp['message'][] =  "NFe EMITIDA EM HOMOLOGAÇÃO";
894
            }
895
            $retEvento = $this->nfeProc->getElementsByTagName('retEvento')->item(0);
0 ignored issues
show
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...
896
            $cStat = $this->getTagValue($this->nfeProc, "cStat");
897
            if ($cStat == '110' ||
898
                $cStat == '301' ||
899
                $cStat == '302'
900
            ) {
901
                $resp['status'] = false;
902
                $resp['message'][] = "NFe DENEGADA";
903
            } elseif ($cStat == '101'
904
                || $cStat == '151'
905
                || $cStat == '135'
906
                || $cStat == '155'
907
                || $this->cancelFlag === true
908
            ) {
909
                $resp['status'] = false;
910
                $resp['message'][] = "NFe CANCELADA";
911
            } elseif (!empty($retEvento)) {
912
                $infEvento = $retEvento->getElementsByTagName('infEvento')->item(0);
913
                $cStat = $this->getTagValue($infEvento, "cStat");
914
                $tpEvento= $this->getTagValue($infEvento, "tpEvento");
915
                $dhEvento = $this->toDateTime($this->getTagValue($infEvento, "dhRegEvento"))->format("d/m/Y H:i:s");
916
                $nProt = $this->getTagValue($infEvento, "nProt");
917
                if ($tpEvento == '110111' &&
918
                    ($cStat == '101' ||
919
                     $cStat == '151' ||
920
                     $cStat == '135' ||
921
                     $cStat == '155')
922
                ) {
923
                    $resp['status'] = false;
924
                    $resp['message'][] = "NFe CANCELADA";
925
                    $resp['submessage'] = "{$dhEvento} - {$nProt}";
926
                }
927
            }
928
        }
929
        return $resp;
930
    }
931
932
    /**
933
     *header
934
     * Monta o cabelhalho da DANFE (retrato e paisagem)
935
     *
936
     * @param number $x      Posição horizontal inicial, canto esquerdo
937
     * @param number $y      Posição vertical inicial, canto superior
938
     * @param number $pag    Número da Página
939
     * @param number $totPag Total de páginas
940
     *
941
     * @return number Posição vertical final
942
     */
943
    protected function header($x = 0, $y = 0, $pag = '1', $totPag = '1')
944
    {
945
        $oldX = $x;
946
        $oldY = $y;
947
        if ($this->orientacao == 'P') {
948
            $maxW = $this->wPrint;
949
        } else {
950
            if ($pag == 1) { // primeira página
951
                $maxW = $this->wPrint - $this->wCanhoto;
952
            } else { // páginas seguintes
953
                $maxW = $this->wPrint;
954
            }
955
        }
956
        //####################################################################################
957
        //coluna esquerda identificação do emitente
958
        $w = round($maxW * 0.41, 0);
959
        if ($this->orientacao == 'P') {
960
            $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I'];
961
        } else {
962
            $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
963
        }
964
        $w1   = $w;
965
        $h    = 32;
966
        $oldY += $h;
967
        $this->pdf->textBox($x, $y, $w, $h);
968
        $texto = 'IDENTIFICAÇÃO DO EMITENTE';
969
        $this->pdf->textBox($x, $y, $w, 5, $texto, $aFont, 'T', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
970
        //estabelecer o alinhamento
971
        //pode ser left L, center C, right R, full logo L
972
        //se for left separar 1/3 da largura para o tamanho da imagem
973
        //os outros 2/3 serão usados para os dados do emitente
974
        //se for center separar 1/2 da altura para o logo e 1/2 para os dados
975
        //se for right separa 2/3 para os dados e o terço seguinte para o logo
976
        //se não houver logo centraliza dos dados do emitente
977
        // coloca o logo
978
        if (! empty($this->logomarca)) {
979
            $logoInfo = getimagesize($this->logomarca);
980
            //largura da imagem em mm
981
            $logoWmm = ($logoInfo[0] / 72) * 25.4;
982
            //altura da imagem em mm
983
            $logoHmm = ($logoInfo[1] / 72) * 25.4;
984
            if ($this->logoAlign == 'L') {
985
                $nImgW = round($w / 3, 0);
986
                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
987
                $xImg  = $x + 1;
988
                $yImg  = round(($h - $nImgH) / 2, 0) + $y;
989
                //estabelecer posições do texto
990
                $x1 = round($xImg + $nImgW + 1, 0);
991
                $y1 = round($h / 3 + $y, 0);
992
                $tw = round(2 * $w / 3, 0);
993
            } elseif ($this->logoAlign == 'C') {
994
                $nImgH = round($h / 3, 0);
995
                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
996
                $xImg  = round(($w - $nImgW) / 2 + $x, 0);
997
                $yImg  = $y + 3;
998
                $x1    = $x;
999
                $y1    = round($yImg + $nImgH + 1, 0);
1000
                $tw    = $w;
1001
            } elseif ($this->logoAlign == 'R') {
1002
                $nImgW = round($w / 3, 0);
1003
                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
1004
                $xImg  = round($x + ($w - (1 + $nImgW)), 0);
1005
                $yImg  = round(($h - $nImgH) / 2, 0) + $y;
1006
                $x1    = $x;
1007
                $y1    = round($h / 3 + $y, 0);
1008
                $tw    = round(2 * $w / 3, 0);
1009
            } elseif ($this->logoAlign == 'F') {
1010
                $nImgH = round($h - 5, 0);
1011
                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
1012
                $xImg  = round(($w - $nImgW) / 2 + $x, 0);
1013
                $yImg  = $y + 3;
1014
                $x1    = $x;
1015
                $y1    = round($yImg + $nImgH + 1, 0);
1016
                $tw    = $w;
1017
            }
1018
            $type = (substr($this->logomarca, 0, 7) === 'data://') ? 'jpg' : null;
0 ignored issues
show
Unused Code introduced by
$type 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...
1019
            $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg');
0 ignored issues
show
Bug introduced by
The variable $xImg does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
Bug introduced by
The variable $nImgH does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
Bug introduced by
The variable $nImgW does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
Bug introduced by
The variable $yImg does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
1020
        } else {
1021
            $x1 = $x;
1022
            $y1 = round($h / 3 + $y, 0);
1023
            $tw = $w;
1024
        }
1025
        // monta as informações apenas se diferente de full logo
1026
        if ($this->logoAlign !== 'F') {
1027
            //Nome emitente
1028
            $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B'];
1029
            $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
1030
            $this->pdf->textBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
0 ignored issues
show
Bug introduced by
The variable $y1 does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
Bug introduced by
The variable $x1 does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
Bug introduced by
The variable $tw does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1031
            //endereço
1032
            $y1     = $y1 + 5;
1033
            $aFont  = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
1034
            $fone   = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1035
                ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
1036
                : '';
1037
            $lgr    = $this->getTagValue($this->enderEmit, "xLgr");
1038
            $nro    = $this->getTagValue($this->enderEmit, "nro");
1039
            $cpl    = $this->getTagValue($this->enderEmit, "xCpl", " - ");
1040
            $bairro = $this->getTagValue($this->enderEmit, "xBairro");
1041
            $CEP    = $this->getTagValue($this->enderEmit, "CEP");
1042
            $CEP    = $this->formatField($CEP, "#####-###");
1043
            $mun    = $this->getTagValue($this->enderEmit, "xMun");
1044
            $UF     = $this->getTagValue($this->enderEmit, "UF");
1045
            $texto  = $lgr . ", " . $nro . $cpl . "\n" . $bairro . " - "
1046
                . $CEP . "\n" . $mun . " - " . $UF . " "
1047
                . "Fone/Fax: " . $fone;
1048
            $this->pdf->textBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1049
        }
1050
1051
        //####################################################################################
1052
        //coluna central Danfe
1053
        $x  += $w;
1054
        $w  = round($maxW * 0.17, 0);//35;
1055
        $w2 = $w;
1056
        $h  = 32;
1057
        $this->pdf->textBox($x, $y, $w, $h);
1058
1059
        $texto = "DANFE";
1060
        $aFont = ['font' => $this->fontePadrao, 'size' => 14, 'style' => 'B'];
1061
        $this->pdf->textBox($x, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1062
        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
1063
        $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
1064
        $h     = 20;
1065
        $this->pdf->textBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1066
1067
        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
1068
        $texto = '0 - ENTRADA';
1069
        $y1    = $y + 14;
1070
        $h     = 8;
1071
        $this->pdf->textBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1072
        $texto = '1 - SAÍDA';
1073
        $y1    = $y + 17;
1074
        $this->pdf->textBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1075
        //tipo de nF
1076
        $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B'];
1077
        $y1    = $y + 13;
1078
        $h     = 7;
1079
        $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
1080
        $this->pdf->textBox($x + 27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1081
        //numero da NF
1082
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1083
        $y1    = $y + 20;
1084
        $numNF = str_pad(
1085
            $this->ide->getElementsByTagName('nNF')->item(0)->nodeValue,
1086
            9,
1087
            "0",
1088
            STR_PAD_LEFT
1089
        );
1090
        $numNF = $this->formatField($numNF, "###.###.###");
1091
        $texto = "Nº. " . $numNF;
1092
        $this->pdf->textBox($x, $y1, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1093
        //Série
1094
        $y1    = $y + 23;
1095
        $serie = str_pad(
1096
            $this->ide->getElementsByTagName('serie')->item(0)->nodeValue,
1097
            3,
1098
            "0",
1099
            STR_PAD_LEFT
1100
        );
1101
        $texto = "Série " . $serie;
1102
        $this->pdf->textBox($x, $y1, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1103
        //numero paginas
1104
        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'I'];
1105
        $y1    = $y + 26;
1106
        $texto = "Folha " . $pag . "/" . $totPag;
1107
        $this->pdf->textBox($x, $y1, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1108
1109
        //####################################################################################
1110
        //coluna codigo de barras
1111
        $x  += $w;
1112
        $w  = ($maxW - $w1 - $w2);//85;
1113
        $w3 = $w;
1114
        $h  = 32;
1115
        $this->pdf->textBox($x, $y, $w, $h);
1116
        $this->pdf->setFillColor(0, 0, 0);
1117
        $chave_acesso = str_replace('NFe', '', $this->infNFe->getAttribute("Id"));
1118
        $bW           = 75;
1119
        $bH           = 12;
1120
        //codigo de barras
1121
        $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
1122
        //linhas divisorias
1123
        $this->pdf->line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH);
1124
        $this->pdf->line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH);
1125
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1126
        $y1    = $y + 4 + $bH;
1127
        $h     = 7;
1128
        $texto = 'CHAVE DE ACESSO';
1129
        $this->pdf->textBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1130
        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
1131
        $y1    = $y + 8 + $bH;
1132
        $texto = $this->formatField($chave_acesso, $this->formatoChave);
1133
        $this->pdf->textBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1134
        $y1                = $y + 12 + $bH;
1135
        $aFont             = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
1136
        $chaveContingencia = "";
1137
        if (!empty($this->epec) && $this->tpEmis == '4') {
1138
            $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO EPEC';
1139
        } else {
1140
            $cabecalhoProtoAutorizacao = 'PROTOCOLO DE AUTORIZAÇÃO DE USO';
1141
        }
1142
        if (($this->tpEmis == 2 || $this->tpEmis == 5)) {
1143
            $cabecalhoProtoAutorizacao = "DADOS DA NF-E";
1144
            $chaveContingencia         = $this->geraChaveAdicionalDeContingencia();
1145
            $this->pdf->setFillColor(0, 0, 0);
1146
            //codigo de barras
1147
            $this->pdf->code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2);
1148
        } else {
1149
            $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1150
            $this->pdf->textBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1151
            $y1    = $y + 16 + $bH;
1152
            $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1153
            $this->pdf->textBox(
1154
                $x + 2,
1155
                $y1,
1156
                $w - 2,
1157
                $h,
1158
                $texto,
1159
                $aFont,
1160
                'T',
1161
                'C',
1162
                0,
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1163
                'http://www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora'
1164
            );
1165
        }
1166
1167
        //####################################################################################
1168
        //Dados da NF do cabeçalho
1169
        //natureza da operação
1170
        $texto = 'NATUREZA DA OPERAÇÃO';
1171
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1172
        $w     = $w1 + $w2;
1173
        $y     = $oldY;
1174
        $oldY  += $h;
1175
        $x     = $oldX;
1176
        $h     = 7;
1177
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1178
        $texto = $this->ide->getElementsByTagName("natOp")->item(0)->nodeValue;
1179
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1180
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1181
        $x += $w;
1182
        $w = $w3;
1183
        //PROTOCOLO DE AUTORIZAÇÃO DE USO ou DADOS da NF-E
1184
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1185
        $this->pdf->textBox($x, $y, $w, $h, $cabecalhoProtoAutorizacao, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1186
        // algumas NFe podem estar sem o protocolo de uso portanto sua existencia deve ser
1187
        // testada antes de tentar obter a informação.
1188
        // NOTA : DANFE sem protocolo deve existir somente no caso de contingência !!!
1189
        // Além disso, existem várias NFes em contingência que eu recebo com protocolo de autorização.
1190
        // Na minha opinião, deveríamos mostra-lo, mas o  manual  da NFe v4.01 diz outra coisa...
1191
        if (($this->tpEmis == 2 || $this->tpEmis == 5) && empty($this->epec)) {
1192
            $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
1193
            $texto = $this->formatField(
1194
                $chaveContingencia,
1195
                "#### #### #### #### #### #### #### #### ####"
1196
            );
1197
            $cStat = '';
0 ignored issues
show
Unused Code introduced by
$cStat 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...
1198
        } else {
1199
            $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1200
            if (!empty($this->epec)) {
1201
                $texto = $this->epec['protocolo'] . ' - ' . $this->epec['data'];
1202
                $cStat = '';
0 ignored issues
show
Unused Code introduced by
$cStat 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...
1203
            } else {
1204
                if (isset($this->nfeProc)) {
1205
                    $texto  = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue)
1206
                        ? $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue
1207
                        : '';
1208
                    $dtHora = $this->toDateTime(
1209
                        $this->nfeProc->getElementsByTagName("dhRecbto")->item(0)->nodeValue
1210
                    );
1211
                    if ($texto != '') {
1212
                        $texto .= "  -  " . $dtHora->format('d/m/Y H:i:s');
1213
                    }
1214
                    $cStat = $this->nfeProc->getElementsByTagName("cStat")->item(0)->nodeValue;
0 ignored issues
show
Unused Code introduced by
$cStat 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...
1215
                } else {
1216
                    $texto = '';
1217
                    $cStat = '';
0 ignored issues
show
Unused Code introduced by
$cStat 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...
1218
                }
1219
            }
1220
        }
1221
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1222
        //####################################################################################
1223
        //INSCRIÇÃO ESTADUAL
1224
        $w     = round($maxW * 0.250, 0);
1225
        $y     += $h;
1226
        $oldY  += $h;
1227
        $x     = $oldX;
1228
        $texto = 'INSCRIÇÃO ESTADUAL';
1229
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1230
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1231
        $texto = $this->getTagValue($this->emit, "IE");
1232
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1233
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1234
        //INSCRIÇÃO MUNICIPAL
1235
        $x     += $w;
1236
        $texto = 'INSCRIÇÃO MUNICIPAL';
1237
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1238
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1239
        $texto = $this->getTagValue($this->emit, "IM");
1240
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1241
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1242
        //INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.
1243
        $x     += $w;
1244
        $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.';
1245
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1246
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1247
        $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1248
            ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue
1249
            : '';
1250
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1251
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1252
        //CNPJ
1253
        $x     += $w;
1254
        $w     = ($maxW - (3 * $w));
1255
        $texto = 'CNPJ / CPF';
1256
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1257
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1258
        //Pegando valor do CPF/CNPJ
1259
        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1260
            $texto = $this->formatField(
1261
                $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1262
                "###.###.###/####-##"
1263
            );
1264
        } else {
1265
            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue)
1266
                ? $this->formatField(
1267
                    $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1268
                    "###.###.###-##"
1269
                )
1270
                : '';
1271
        }
1272
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1273
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1274
1275
        //####################################################################################
1276
        //Indicação de NF Homologação, cancelamento e falta de protocolo
1277
        $tpAmb = $this->ide->getElementsByTagName('tpAmb')->item(0)->nodeValue;
0 ignored issues
show
Unused Code introduced by
$tpAmb 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...
1278
        //indicar cancelamento
1279
        $resp = $this->statusNFe();
1280
        if (!$resp['status']) {
1281
            $n = count($resp['message']);
1282
            $alttot = $n * 15;
1283
            $x = 10;
1284
            $y = $this->hPrint/2 - $alttot/2;
1285
            $h = 15;
1286
            $w = $maxW - (2 * $x);
1287
            $this->pdf->settextcolor(90, 90, 90);
1288
1289
            foreach ($resp['message'] as $msg) {
1290
                $aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B'];
1291
                $this->pdf->textBox($x, $y, $w, $h, $msg, $aFont, 'C', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1292
                $y += $h;
1293
            }
1294
            $texto = $resp['submessage'];
1295
            if (!empty($texto)) {
1296
                $y += 3;
1297
                $h = 5;
1298
                $aFont = ['font' => $this->fontePadrao, 'size' => 20, 'style' => 'B'];
1299
                $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1300
                $y += $h;
1301
            }
1302
            $y += 5;
1303
            $w = $maxW - (2 * $x);
1304
            $texto = "SEM VALOR FISCAL";
1305
            $aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B'];
1306
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1307
            $this->pdf->settextcolor(0, 0, 0);
1308
        }
1309
        if (!empty($this->epec) && $this->tpEmis == 4) {
1310
            //EPEC
1311
            $x = 10;
1312
            $y = $this->hPrint - 130;
1313
            $h = 25;
1314
            $w = $maxW - (2 * $x);
1315
            $this->pdf->SetTextColor(200, 200, 200);
1316
            $texto = "DANFE impresso em contingência -\n" .
1317
                "EPEC regularmente recebido pela Receita\n" .
1318
                "Federal do Brasil";
1319
            $aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B'];
1320
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1321
            $this->pdf->SetTextColor(0, 0, 0);
1322
        }
1323
1324
        return $oldY;
1325
    } //fim header
1326
1327
    /**
1328
     * destinatarioDANFE
1329
     * Monta o campo com os dados do destinatário na DANFE. (retrato e paisagem)
1330
     *
1331
     * @name   destinatarioDANFE
1332
     *
1333
     * @param number $x Posição horizontal canto esquerdo
1334
     * @param number $y Posição vertical canto superior
1335
     *
1336
     * @return number Posição vertical final
1337
     */
1338
    protected function destinatarioDANFE($x = 0, $y = 0)
1339
    {
1340
        //####################################################################################
1341
        //DESTINATÁRIO / REMETENTE
1342
        $oldX = $x;
1343
        $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
1344
        if ($this->orientacao == 'P') {
1345
            $maxW = $this->wPrint;
1346
        } else {
1347
            $maxW = $this->wPrint - $this->wCanhoto;
1348
        }
1349
        $w     = $maxW;
1350
        $h     = 7;
1351
        $texto = 'DESTINATÁRIO / REMETENTE';
1352
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1353
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1354
        //NOME / RAZÃO SOCIAL
1355
        $w     = round($maxW * 0.61, 0);
1356
        $w1    = $w;
1357
        $y     += 3;
1358
        $texto = 'NOME / RAZÃO SOCIAL';
1359
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1360
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1361
        $texto = $this->dest->getElementsByTagName("xNome")->item(0)->nodeValue;
1362
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1363
        if ($this->orientacao == 'P') {
1364
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1365
        } else {
1366
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1367
        }
1368
        //CNPJ / CPF
1369
        $x     += $w;
1370
        $w     = round($maxW * 0.23, 0);
1371
        $w2    = $w;
1372
        $texto = 'CNPJ / CPF';
1373
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1374
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1375
        //Pegando valor do CPF/CNPJ
1376
        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1377
            $texto = $this->formatField(
1378
                $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1379
                "###.###.###/####-##"
1380
            );
1381
        } else {
1382
            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue)
1383
                ? $this->formatField(
1384
                    $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1385
                    "###.###.###-##"
1386
                )
1387
                : '';
1388
        }
1389
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1390
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1391
        //DATA DA EMISSÃO
1392
        $x     += $w;
1393
        $w     = $maxW - ($w1 + $w2);
1394
        $wx    = $w;
1395
        $texto = 'DATA DA EMISSÃO';
1396
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1397
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1398
        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue)
1399
            ? $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue
1400
            : '';
1401
        if ($dEmi == '') {
1402
            $dEmi  = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue)
1403
                ? $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue
1404
                : '';
1405
            $aDemi = explode('T', $dEmi);
1406
            $dEmi  = $aDemi[0];
1407
        }
1408
        $texto = $this->ymdTodmy($dEmi);
1409
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1410
        if ($this->orientacao == 'P') {
1411
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1412
        } else {
1413
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1414
        }
1415
        //ENDEREÇO
1416
        $w     = round($maxW * 0.47, 0);
1417
        $w1    = $w;
1418
        $y     += $h;
1419
        $x     = $oldX;
1420
        $texto = 'ENDEREÇO';
1421
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1422
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1423
        $texto = $this->dest->getElementsByTagName("xLgr")->item(0)->nodeValue;
1424
        $texto .= ', ' . $this->dest->getElementsByTagName("nro")->item(0)->nodeValue;
1425
        $texto .= $this->getTagValue($this->dest, "xCpl", " - ");
1426
1427
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1428
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1429
        //BAIRRO / DISTRITO
1430
        $x     += $w;
1431
        $w     = round($maxW * 0.21, 0);
1432
        $w2    = $w;
1433
        $texto = 'BAIRRO / DISTRITO';
1434
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1435
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1436
        $texto = $this->dest->getElementsByTagName("xBairro")->item(0)->nodeValue;
1437
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1438
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1439
        //CEP
1440
        $x     += $w;
1441
        $w     = $maxW - $w1 - $w2 - $wx;
1442
        $w2    = $w;
0 ignored issues
show
Unused Code introduced by
$w2 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...
1443
        $texto = 'CEP';
1444
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1445
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1446
        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue)
1447
            ? $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue
1448
            : '';
1449
        $texto = $this->formatField($texto, "#####-###");
1450
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1451
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1452
        //DATA DA SAÍDA
1453
        $x     += $w;
1454
        $w     = $wx;
1455
        $texto = 'DATA DA SAÍDA/ENTRADA';
1456
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1457
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1458
        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue)
1459
            ? $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue
1460
            : '';
1461
        if ($dSaiEnt == '') {
1462
            $dSaiEnt  = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1463
                ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1464
                : '';
1465
            $aDsaient = explode('T', $dSaiEnt);
1466
            $dSaiEnt  = $aDsaient[0];
1467
        }
1468
        $texto = $this->ymdTodmy($dSaiEnt);
1469
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1470
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1471
        //MUNICÍPIO
1472
        $w     = $w1;
1473
        $y     += $h;
1474
        $x     = $oldX;
1475
        $texto = 'MUNICÍPIO';
1476
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1477
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1478
        $texto = $this->dest->getElementsByTagName("xMun")->item(0)->nodeValue;
1479
        if (strtoupper(trim($texto)) == "EXTERIOR"
1480
            && $this->dest->getElementsByTagName("xPais")->length > 0
1481
        ) {
1482
            $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1483
        }
1484
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1485
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1486
        //UF
1487
        $x     += $w;
1488
        $w     = 8;
1489
        $texto = 'UF';
1490
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1491
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1492
        $texto = $this->dest->getElementsByTagName("UF")->item(0)->nodeValue;
1493
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1494
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1495
        //FONE / FAX
1496
        $x     += $w;
1497
        $w     = round(($maxW - $w1 - $wx - 8) / 2, 0);
1498
        $w3    = $w;
1499
        $texto = 'FONE / FAX';
1500
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1501
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1502
        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue)
1503
            ? $this->dest->getElementsByTagName("fone")->item(0)->nodeValue
1504
            : '';
1505
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1506
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1507
        //INSCRIÇÃO ESTADUAL
1508
        $x     += $w;
1509
        $w     = $maxW - $w1 - $wx - 8 - $w3;
1510
        $texto = 'INSCRIÇÃO ESTADUAL';
1511
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1512
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1513
        $IE    = $this->dest->getElementsByTagName("IE");
1514
        $texto = ($IE && $IE->length > 0) ? $IE->item(0)->nodeValue : '';
1515
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1516
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1517
        //HORA DA SAÍDA
1518
        $x     += $w;
1519
        $w     = $wx;
1520
        $texto = 'HORA DA SAÍDA/ENTRADA';
1521
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1522
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1523
        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue)
1524
            ? $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue
1525
            : '';
1526
        if ($hSaiEnt == '') {
1527
            $dhSaiEnt   = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1528
                ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1529
                : '';
1530
            $tsDhSaiEnt = $this->toDateTime($dhSaiEnt);
1531
            if ($tsDhSaiEnt) {
1532
                $hSaiEnt = $tsDhSaiEnt->format('H:i:s');
1533
            }
1534
        }
1535
        $texto = $hSaiEnt;
1536
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1537
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1538
1539
        return ($y + $h);
1540
    } //fim da função destinatarioDANFE
1541
1542
    /**
1543
     * localEntregaDANFE
1544
     * Monta o campo com os dados do local de entrega na DANFE. (retrato e paisagem)
1545
     *
1546
     * @name   localEntregaDANFE
1547
     *
1548
     * @param number $x Posição horizontal canto esquerdo
1549
     * @param number $y Posição vertical canto superior
1550
     *
1551
     * @return number Posição vertical final
1552
     */
1553
    protected function localEntregaDANFE($x = 0, $y = 0)
1554
    {
1555
        //####################################################################################
1556
        //LOCAL DE ENTREGA
1557
        $oldX = $x;
1558
        if ($this->orientacao == 'P') {
1559
            $maxW = $this->wPrint;
1560
        } else {
1561
            $maxW = $this->wPrint - $this->wCanhoto;
1562
        }
1563
        $w     = $maxW;
1564
        $h     = 7;
1565
        $texto = 'INFORMAÇÕES DO LOCAL DE ENTREGA';
1566
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1567
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1568
        //NOME / RAZÃO SOCIAL
1569
        $w     = round($maxW * 0.61, 0);
1570
        $w1    = $w;
1571
        $y     += 3;
1572
        $texto = 'NOME / RAZÃO SOCIAL';
1573
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1574
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1575
        $texto = '';
1576
        if ($this->entrega->getElementsByTagName("xNome")->item(0)) {
1577
            $texto = $this->entrega->getElementsByTagName("xNome")->item(0)->nodeValue;
1578
        }
1579
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1580
        if ($this->orientacao == 'P') {
1581
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1582
        } else {
1583
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1584
        }
1585
        //CNPJ / CPF
1586
        $x     += $w;
1587
        $w     = round($maxW * 0.23, 0);
1588
        $w2    = $w;
1589
        $texto = 'CNPJ / CPF';
1590
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1591
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1592
        //Pegando valor do CPF/CNPJ
1593
        if (! empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1594
            $texto = $this->formatField(
1595
                $this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1596
                "###.###.###/####-##"
1597
            );
1598
        } else {
1599
            $texto = ! empty($this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1600
                $this->formatField(
1601
                    $this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue,
1602
                    "###.###.###-##"
1603
                ) : '';
1604
        }
1605
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1606
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1607
        //INSCRIÇÃO ESTADUAL
1608
        $x     += $w;
1609
        $w     = $maxW - ($w1 + $w2);
1610
        $wx    = $w;
1611
        $texto = 'INSCRIÇÃO ESTADUAL';
1612
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1613
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1614
        $texto = '';
1615
        if ($this->entrega->getElementsByTagName("IE")->item(0)) {
1616
            $texto = $this->entrega->getElementsByTagName("IE")->item(0)->nodeValue;
1617
        }
1618
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1619
        if ($this->orientacao == 'P') {
1620
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1621
        } else {
1622
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1623
        }
1624
        //ENDEREÇO
1625
        $w     = round($maxW * 0.355, 0) + $wx;
1626
        $w1    = $w;
1627
        $y     += $h;
1628
        $x     = $oldX;
1629
        $texto = 'ENDEREÇO';
1630
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1631
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1632
        $texto = $this->entrega->getElementsByTagName("xLgr")->item(0)->nodeValue;
1633
        $texto .= ', ' . $this->entrega->getElementsByTagName("nro")->item(0)->nodeValue;
1634
        $texto .= $this->getTagValue($this->entrega, "xCpl", " - ");
1635
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1636
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1637
        //BAIRRO / DISTRITO
1638
        $x     += $w;
1639
        $w     = round($maxW * 0.335, 0);
1640
        $w2    = $w;
1641
        $texto = 'BAIRRO / DISTRITO';
1642
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1643
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1644
        $texto = $this->entrega->getElementsByTagName("xBairro")->item(0)->nodeValue;
1645
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1646
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1647
        //CEP
1648
        $x     += $w;
1649
        $w     = $maxW - ($w1 + $w2);
1650
        $texto = 'CEP';
1651
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1652
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1653
        $texto = ! empty($this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1654
            $this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1655
        $texto = $this->formatField($texto, "#####-###");
1656
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1657
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1658
        //MUNICÍPIO
1659
        $w     = round($maxW * 0.805, 0);
1660
        $w1    = $w;
1661
        $y     += $h;
1662
        $x     = $oldX;
1663
        $texto = 'MUNICÍPIO';
1664
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1665
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1666
        $texto = $this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue;
1667
        if (strtoupper(trim($texto)) == "EXTERIOR" && $this->entrega->getElementsByTagName("xPais")->length > 0) {
1668
            $texto .= " - " . $this->entrega->getElementsByTagName("xPais")->item(0)->nodeValue;
1669
        }
1670
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1671
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1672
        //UF
1673
        $x     += $w;
1674
        $w     = 8;
1675
        $texto = 'UF';
1676
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1677
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1678
        $texto = $this->entrega->getElementsByTagName("UF")->item(0)->nodeValue;
1679
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1680
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1681
        //FONE / FAX
1682
        $x     += $w;
1683
        $w     = $maxW - $w - $w1;
1684
        $texto = 'FONE / FAX';
1685
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1686
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1687
        $texto = ! empty($this->entrega->getElementsByTagName("fone")->item(0)->nodeValue) ?
1688
            $this->entrega->getElementsByTagName("fone")->item(0)->nodeValue : '';
1689
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1690
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1691
1692
        return ($y + $h);
1693
    } //fim da função localEntregaDANFE
1694
1695
    /**
1696
     * localretiradaDANFE
1697
     * Monta o campo com os dados do local de entrega na DANFE. (retrato e paisagem)
1698
     *
1699
     * @name   localretiradaDANFE
1700
     *
1701
     * @param number $x Posição horizontal canto esquerdo
1702
     * @param number $y Posição vertical canto superior
1703
     *
1704
     * @return number Posição vertical final
1705
     */
1706
    protected function localRetiradaDANFE($x = 0, $y = 0)
1707
    {
1708
        //####################################################################################
1709
        //LOCAL DE RETIRADA
1710
        $oldX = $x;
1711
        if ($this->orientacao == 'P') {
1712
            $maxW = $this->wPrint;
1713
        } else {
1714
            $maxW = $this->wPrint - $this->wCanhoto;
1715
        }
1716
        $w     = $maxW;
1717
        $h     = 7;
1718
        $texto = 'INFORMAÇÕES DO LOCAL DE RETIRADA';
1719
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1720
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1721
        //NOME / RAZÃO SOCIAL
1722
        $w     = round($maxW * 0.61, 0);
1723
        $w1    = $w;
1724
        $y     += 3;
1725
        $texto = 'NOME / RAZÃO SOCIAL';
1726
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1727
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1728
        $texto = '';
1729
        if ($this->retirada->getElementsByTagName("xNome")->item(0)) {
1730
            $texto = $this->retirada->getElementsByTagName("xNome")->item(0)->nodeValue;
1731
        }
1732
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1733
        if ($this->orientacao == 'P') {
1734
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1735
        } else {
1736
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1737
        }
1738
        //CNPJ / CPF
1739
        $x     += $w;
1740
        $w     = round($maxW * 0.23, 0);
1741
        $w2    = $w;
1742
        $texto = 'CNPJ / CPF';
1743
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1744
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1745
        //Pegando valor do CPF/CNPJ
1746
        if (! empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1747
            $texto = $this->formatField(
1748
                $this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1749
                "###.###.###/####-##"
1750
            );
1751
        } else {
1752
            $texto = ! empty($this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1753
                $this->formatField(
1754
                    $this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue,
1755
                    "###.###.###-##"
1756
                ) : '';
1757
        }
1758
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1759
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1760
        //INSCRIÇÃO ESTADUAL
1761
        $x     += $w;
1762
        $w     = $maxW - ($w1 + $w2);
1763
        $wx    = $w;
1764
        $texto = 'INSCRIÇÃO ESTADUAL';
1765
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1766
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1767
        $texto = '';
1768
        if ($this->retirada->getElementsByTagName("IE")->item(0)) {
1769
            $texto = $this->retirada->getElementsByTagName("IE")->item(0)->nodeValue;
1770
        }
1771
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1772
        if ($this->orientacao == 'P') {
1773
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1774
        } else {
1775
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1776
        }
1777
        //ENDEREÇO
1778
        $w     = round($maxW * 0.355, 0) + $wx;
1779
        $w1    = $w;
1780
        $y     += $h;
1781
        $x     = $oldX;
1782
        $texto = 'ENDEREÇO';
1783
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1784
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1785
        $texto = $this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue;
1786
        $texto .= ', ' . $this->retirada->getElementsByTagName("nro")->item(0)->nodeValue;
1787
        $texto .= $this->getTagValue($this->retirada, "xCpl", " - ");
1788
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1789
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1790
        //BAIRRO / DISTRITO
1791
        $x     += $w;
1792
        $w     = round($maxW * 0.335, 0);
1793
        $w2    = $w;
1794
        $texto = 'BAIRRO / DISTRITO';
1795
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1796
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1797
        $texto = $this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue;
1798
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1799
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1800
        //CEP
1801
        $x     += $w;
1802
        $w     = $maxW - ($w1 + $w2);
1803
        $texto = 'CEP';
1804
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1805
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1806
        $texto = ! empty($this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1807
            $this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1808
        $texto = $this->formatField($texto, "#####-###");
1809
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1810
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1811
        //MUNICÍPIO
1812
        $w     = round($maxW * 0.805, 0);
1813
        $w1    = $w;
1814
        $y     += $h;
1815
        $x     = $oldX;
1816
        $texto = 'MUNICÍPIO';
1817
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1818
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1819
        $texto = $this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue;
1820
        if (strtoupper(trim($texto)) == "EXTERIOR" && $this->retirada->getElementsByTagName("xPais")->length > 0) {
1821
            $texto .= " - " . $this->retirada->getElementsByTagName("xPais")->item(0)->nodeValue;
1822
        }
1823
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1824
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1825
        //UF
1826
        $x     += $w;
1827
        $w     = 8;
1828
        $texto = 'UF';
1829
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1830
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1831
        $texto = $this->retirada->getElementsByTagName("UF")->item(0)->nodeValue;
1832
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1833
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1834
        //FONE / FAX
1835
        $x     += $w;
1836
        $w     = $maxW - $w - $w1;
1837
        $texto = 'FONE / FAX';
1838
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1839
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1840
        $texto = ! empty($this->retirada->getElementsByTagName("fone")->item(0)->nodeValue) ?
1841
            $this->retirada->getElementsByTagName("fone")->item(0)->nodeValue : '';
1842
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1843
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1844
1845
        return ($y + $h);
1846
    } //fim da função localRetiradaDANFE
1847
1848
    /**
1849
     * getTextoFatura
1850
     * Gera a String do Texto da Fatura
1851
     *
1852
     * @name   getTextoFatura
1853
     * @return uma String com o texto ou "";
1854
     */
1855
    protected function getTextoFatura()
1856
    {
1857
        if (isset($this->cobr)) {
1858
            $fat = $this->cobr->getElementsByTagName("fat")->item(0);
1859
            if (isset($fat)) {
1860
                if (! empty($this->getTagValue($this->ide, "indPag"))) {
1861
                    $textoIndPag = "";
1862
                    $indPag      = $this->getTagValue($this->ide, "indPag");
1863
                    if ($indPag === "0") {
1864
                        $textoIndPag = "Pagamento à Vista - ";
1865
                    } elseif ($indPag === "1") {
1866
                        $textoIndPag = "Pagamento à Prazo - ";
1867
                    }
1868
                    $nFat  = $this->getTagValue($fat, "nFat", "Fatura: ");
1869
                    $vOrig = $this->getTagValue($fat, "vOrig", " Valor Original: ");
1870
                    $vDesc = $this->getTagValue($fat, "vDesc", " Desconto: ");
1871
                    $vLiq  = $this->getTagValue($fat, "vLiq", " Valor Líquido: ");
1872
                    $texto = $textoIndPag . $nFat . $vOrig . $vDesc . $vLiq;
1873
1874
                    return $texto;
1875
                } else {
1876
                    $pag = $this->dom->getElementsByTagName("pag");
1877
                    if ($tPag = $this->getTagValue($pag->item(0), "tPag")) {
1878
                        return $this->tipoPag($tPag);
1879
                    }
1880
                }
1881
            }
1882
        }
1883
        return "";
1884
    }
1885
1886
    /**
1887
     * sizeExtraTextoFatura
1888
     * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata.
1889
     *
1890
     * @name   sizeExtraTextoFatura
1891
     * @return integer
1892
     */
1893
    protected function sizeExtraTextoFatura()
1894
    {
1895
        $textoFatura = $this->getTextoFatura();
1896
        //verificar se existem duplicatas
1897
        if ($this->dup->length == 0 && $textoFatura !== "") {
0 ignored issues
show
Bug introduced by
The property length does not seem to exist in DOMNode.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
1898
            return 10;
1899
        }
1900
1901
        return 0;
1902
    }
1903
1904
    /**
1905
     * fatura
1906
     * Monta o campo de duplicatas da DANFE (retrato e paisagem)
1907
     *
1908
     * @name   fatura
1909
     *
1910
     * @param number $x Posição horizontal canto esquerdo
1911
     * @param number $y Posição vertical canto superior
1912
     *
1913
     * @return number Posição vertical final
1914
     */
1915
    protected function fatura($x, $y)
1916
    {
1917
        $linha       = 1;
1918
        $h           = 8 + 3;
0 ignored issues
show
Unused Code introduced by
$h 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...
1919
        $oldx        = $x;
1920
        $textoFatura = $this->getTextoFatura();
1921
        //verificar se existem duplicatas
1922
        if ($this->dup->length > 0 || $textoFatura !== "") {
1923
            //#####################################################################
1924
            //FATURA / DUPLICATA
1925
            $texto = "FATURA / DUPLICATA";
1926
            if ($this->orientacao == 'P') {
1927
                $w = $this->wPrint;
1928
            } else {
1929
                $w = 271;
1930
            }
1931
            $h     = 8;
1932
            $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1933
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1934
            $y       += 3;
1935
            $dups    = "";
0 ignored issues
show
Unused Code introduced by
$dups 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...
1936
            $dupcont = 0;
1937
            $nFat    = $this->dup->length;
0 ignored issues
show
Bug introduced by
The property length does not seem to exist in DOMNode.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
1938
            if ($nFat > 7) {
1939
                $myH = 6;
1940
                $myW = $this->wPrint;
1941
                if ($this->orientacao == 'L') {
1942
                    $myW -= $this->wCanhoto;
1943
                }
1944
                $aFont = ['font' => $this->fontePadrao, 'size' => 9, 'style' => ''];
1945
                $texto = "Existem mais de 7 duplicatas registradas, portanto não "
1946
                    . "serão exibidas, confira diretamente pelo XML.";
1947
                $this->pdf->textBox($x, $y, $myW, $myH, $texto, $aFont, 'C', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1948
1949
                return ($y + $h - 3);
1950
            }
1951
            if ($textoFatura !== "" && $this->exibirTextoFatura) {
1952
                $myH = 6;
1953
                $myW = $this->wPrint;
1954
                if ($this->orientacao == 'L') {
1955
                    $myW -= $this->wCanhoto;
1956
                }
1957
                $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
1958
                $this->pdf->textBox($x, $y, $myW, $myH, $textoFatura, $aFont, 'C', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1959
                $y += $myH + 1;
1960
            }
1961
            if ($this->orientacao == 'P') {
1962
                $w = round($this->wPrint / 7.018, 0) - 1;
1963
            } else {
1964
                $w = 28;
1965
            }
1966
            $increm = 1;
1967
            foreach ($this->dup as $k => $d) {
0 ignored issues
show
Bug introduced by
The expression $this->dup of type object<DOMNode> is not traversable.
Loading history...
1968
                $nDup  = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue)
1969
                    ? $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue
1970
                    : '';
1971
                $dDup  = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
1972
                    ? $this->ymdTodmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
1973
                    : '';
1974
                $vDup  = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue)
1975
                    ? 'R$ ' . number_format(
1976
                        $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
1977
                        2,
1978
                        ",",
1979
                        "."
1980
                    )
1981
                    : '';
1982
                $h     = 8;
1983
                $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...
1984
                if ($nDup != '0' && $nDup != '') {
1985
                    $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1986
                    $this->pdf->textBox($x, $y, $w, $h, 'Num.', $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1987
                    $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1988
                    $this->pdf->textBox($x, $y, $w, $h, $nDup, $aFont, 'T', 'R', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1989
                } else {
1990
                    $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1991
                    $this->pdf->textBox($x, $y, $w, $h, ($dupcont + 1) . "", $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1992
                }
1993
                $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1994
                $this->pdf->textBox($x, $y, $w, $h, 'Venc.', $aFont, 'C', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1995
                $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1996
                $this->pdf->textBox($x, $y, $w, $h, $dDup, $aFont, 'C', 'R', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1997
                $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1998
                $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1999
                $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2000
                $this->pdf->textBox($x, $y, $w, $h, $vDup, $aFont, 'B', 'R', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2001
                $x       += $w + $increm;
2002
                $dupcont += 1;
2003
                if ($this->orientacao == 'P') {
2004
                    $maxDupCont = 6;
2005
                } else {
2006
                    $maxDupCont = 8;
2007
                }
2008
                if ($dupcont > $maxDupCont) {
2009
                    $y       += 9;
2010
                    $x       = $oldx;
2011
                    $dupcont = 0;
2012
                    $linha   += 1;
2013
                }
2014
                if ($linha == 5) {
2015
                    $linha = 4;
2016
                    break;
2017
                }
2018
            }
2019
            if ($dupcont == 0) {
2020
                $y -= 9;
2021
                $linha --;
2022
            }
2023
2024
            return ($y + $h);
2025
        } else {
2026
            $linha = 0;
0 ignored issues
show
Unused Code introduced by
$linha 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...
2027
2028
            return ($y - 2);
2029
        }
2030
    }
2031
2032
    /**
2033
     * pagamento
2034
     * Monta o campo de pagamentos da DANFE (retrato e paisagem) (foi baseada na fatura)
2035
     *
2036
     * @name   pagamento
2037
     *
2038
     * @param number $x Posição horizontal canto esquerdo
2039
     * @param number $y Posição vertical canto superior
2040
     *
2041
     * @return number Posição vertical final
2042
     */
2043
    protected function pagamento($x, $y)
2044
    {
2045
        $linha = 1;
2046
        $h     = 8 + 3;
0 ignored issues
show
Unused Code introduced by
$h 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...
2047
        $oldx  = $x;
2048
        //verificar se existem cobranças definidas
2049
        if (isset($this->detPag) && $this->detPag->length > 0) {
2050
            //#####################################################################
2051
            //Tipo de pagamento
2052
            $texto = "PAGAMENTO";
2053
            if ($this->orientacao == 'P') {
2054
                $w = $this->wPrint;
2055
            } else {
2056
                $w = 271;
2057
            }
2058
            $h     = 8;
2059
            $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2060
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2061
            $y       += 3;
2062
            $dups    = "";
0 ignored issues
show
Unused Code introduced by
$dups 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...
2063
            $dupcont = 0;
2064
            if ($this->orientacao == 'P') {
2065
                $w = round($this->wPrint / 7.018, 0) - 1;
2066
            } else {
2067
                $w = 28;
2068
            }
2069
            if ($this->orientacao == 'P') {
2070
                $maxDupCont = 6;
2071
            } else {
2072
                $maxDupCont = 8;
2073
            }
2074
            $increm         = 1;
2075
            $formaPagamento = [
2076
                '01' => 'Dinheiro',
2077
                '02' => 'Cheque',
2078
                '03' => 'Cartão de Crédito',
2079
                '04' => 'Cartão de Débito',
2080
                '05' => 'Crédito Loja',
2081
                '10' => 'Vale Alimentação',
2082
                '11' => 'Vale Refeição',
2083
                '12' => 'Vale Presente',
2084
                '13' => 'Vale Combustível',
2085
                '14' => 'Duplicata Mercantil',
2086
                '15' => 'Boleto',
2087
                '16' => 'Depósito Bancário',
2088
                '17' => 'Pagamento Instantâneo (PIX)',
2089
                '18' => 'Transferência bancária, Carteira Digital',
2090
                '19' => 'Programa de fidelidade, Cashback, Crédito Virtual',
2091
                '90' => 'Sem pagamento',
2092
                '99' => 'Outros'
2093
            ];
2094
            $bandeira       = [
0 ignored issues
show
Unused Code introduced by
$bandeira 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...
2095
                '01' => 'Visa',
2096
                '02' => 'Mastercard',
2097
                '03' => 'American',
2098
                '04' => 'Sorocred',
2099
                '05' => 'Diners',
2100
                '06' => 'Elo',
2101
                '07' => 'Hipercard',
2102
                '08' => 'Aura',
2103
                '09' => 'Cabal',
2104
                '99' => 'Outros'
2105
            ];
2106
            foreach ($this->detPag as $k => $d) {
2107
                $fPag  = ! empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
2108
                    ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue
2109
                    : '0';
2110
                $vPag  = ! empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
2111
                    ? 'R$ ' . number_format(
2112
                        $this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue,
2113
                        2,
2114
                        ",",
2115
                        "."
2116
                    )
2117
                    : '';
2118
                $h     = 6;
2119
                $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...
2120
                if (isset($formaPagamento[$fPag])) {
2121
                    /*Exibir Item sem pagamento*/
2122
                    if ($fPag == '90') {
2123
                        continue;
2124
                    }
2125
                    $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2126
                    $this->pdf->textBox($x, $y, $w, $h, 'Forma', $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2127
                    $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2128
                    $this->pdf->textBox($x, $y, $w, $h, $formaPagamento[$fPag], $aFont, 'T', 'R', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2129
                } else {
2130
                    $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
2131
                    $this->pdf->textBox($x, $y, $w, $h, "Forma " . $fPag . " não encontrado", $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2132
                }
2133
                $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2134
                $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2135
                $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2136
                $this->pdf->textBox($x, $y, $w, $h, $vPag, $aFont, 'B', 'R', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2137
                $x       += $w + $increm;
2138
                $dupcont += 1;
2139
2140
                if ($dupcont > $maxDupCont) {
2141
                    $y       += 9;
2142
                    $x       = $oldx;
2143
                    $dupcont = 0;
2144
                    $linha   += 1;
2145
                }
2146
                if ($linha == 5) {
2147
                    $linha = 4;
2148
                    break;
2149
                }
2150
            }
2151
            if ($dupcont == 0) {
2152
                $y -= 9;
2153
                $linha --;
2154
            }
2155
2156
            return ($y + $h);
2157
        } else {
2158
            $linha = 0;
0 ignored issues
show
Unused Code introduced by
$linha 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...
2159
2160
            return ($y - 2);
2161
        }
2162
    } //fim da função pagamento
2163
2164
    /**
2165
     * impostoHelper
2166
     * Auxilia a montagem dos campos de impostos e totais da DANFE
2167
     *
2168
     * @name   impostoHelper
2169
     *
2170
     * @param float $x Posição horizontal canto esquerdo
2171
     * @param float $y Posição vertical canto superior
2172
     * @param float $w Largura do campo
2173
     * @param float $h Altura do campo
2174
     * @param float $h Título do campo
2175
     * @param float $h Valor do imposto
2176
     *
2177
     * @return float Sugestão do $x do próximo imposto
2178
     */
2179
    protected function impostoHelper($x, $y, $w, $h, $titulo, $campoImposto)
2180
    {
2181
        $valorImposto = '0,00';
2182
        $the_field    = $this->ICMSTot->getElementsByTagName($campoImposto)->item(0);
2183
        if (isset($the_field)) {
2184
            $the_value = $the_field->nodeValue;
2185
            if (! empty($the_value)) {
2186
                $valorImposto = number_format($the_value, 2, ",", ".");
2187
            }
2188
        }
2189
2190
        $fontTitulo = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2191
        $fontValor  = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2192
        $this->pdf->textBox($x, $y, $w, $h, $titulo, $fontTitulo, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2193
        $this->pdf->textBox($x, $y, $w, $h, $valorImposto, $fontValor, 'B', 'R', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2194
2195
        $next_x = $x + $w;
2196
2197
        return $next_x;
2198
    }
2199
2200
    /**
2201
     * imposto
2202
     * Monta o campo de impostos e totais da DANFE (retrato e paisagem)
2203
     *
2204
     * @param number $x Posição horizontal canto esquerdo
2205
     * @param number $y Posição vertical canto superior
2206
     *
2207
     * @return number Posição vertical final
2208
     */
2209
    protected function imposto($x, $y)
2210
    {
2211
        $x_inicial = $x;
2212
        //#####################################################################
2213
        $campos_por_linha = 9;
2214
        if (! $this->exibirPIS) {
2215
            $campos_por_linha --;
2216
        }
2217
        if (! $this->exibirIcmsInterestadual) {
2218
            $campos_por_linha -= 2;
2219
        }
2220
2221
        if ($this->orientacao == 'P') {
2222
            $maxW       = $this->wPrint;
2223
            $title_size = 31;
2224
        } else {
2225
            $maxW       = $this->wPrint - $this->wCanhoto;
2226
            $title_size = 40;
2227
        }
2228
        $w = $maxW / $campos_por_linha;
2229
2230
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2231
        $texto = "CÁLCULO DO IMPOSTO";
2232
        $this->pdf->textBox($x, $y, $title_size, 8, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2233
        $y += 3;
2234
        $h = 7;
2235
2236
        $x = $this->impostoHelper($x, $y, $w, $h, "BASE DE CÁLC. DO ICMS", "vBC");
2237
        $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DO ICMS", "vICMS");
2238
        $x = $this->impostoHelper($x, $y, $w, $h, "BASE DE CÁLC. ICMS S.T.", "vBCST");
2239
        $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DO ICMS SUBST.", "vST");
2240
        $x = $this->impostoHelper($x, $y, $w, $h, "V. IMP. IMPORTAÇÃO", "vII");
2241
2242
        if ($this->exibirIcmsInterestadual) {
2243
            $x = $this->impostoHelper($x, $y, $w, $h, "V. ICMS UF REMET.", "vICMSUFRemet");
2244
            $x = $this->impostoHelper($x, $y, $w, $h, "V. FCP UF DEST.", "vFCPUFDest");
2245
        }
2246
2247
        if ($this->exibirPIS) {
2248
            $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DO PIS", "vPIS");
2249
        }
2250
2251
        $x = $this->impostoHelper($x, $y, $w, $h, "V. TOTAL PRODUTOS", "vProd");
0 ignored issues
show
Unused Code introduced by
$x 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...
2252
2253
        //
2254
2255
        $y += $h;
2256
        $x = $x_inicial;
2257
2258
        $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DO FRETE", "vFrete");
2259
        $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DO SEGURO", "vSeg");
2260
        $x = $this->impostoHelper($x, $y, $w, $h, "DESCONTO", "vDesc");
2261
        $x = $this->impostoHelper($x, $y, $w, $h, "OUTRAS DESPESAS", "vOutro");
2262
        $x = $this->impostoHelper($x, $y, $w, $h, "VALOR TOTAL IPI", "vIPI");
2263
2264
        if ($this->exibirIcmsInterestadual) {
2265
            $x = $this->impostoHelper($x, $y, $w, $h, "V. ICMS UF DEST.", "vICMSUFDest");
2266
            $x = $this->impostoHelper($x, $y, $w, $h, "V. TOT. TRIB.", "vTotTrib");
2267
        }
2268
        if ($this->exibirPIS) {
2269
            $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DA COFINS", "vCOFINS");
2270
        }
2271
        $x = $this->impostoHelper($x, $y, $w, $h, "V. TOTAL DA NOTA", "vNF");
0 ignored issues
show
Unused Code introduced by
$x 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...
2272
2273
        return ($y + $h);
2274
    } //fim imposto
2275
2276
    /**
2277
     * transporte
2278
     * Monta o campo de transportes da DANFE (retrato e paisagem)
2279
     *
2280
     * @name   transporte
2281
     *
2282
     * @param float $x Posição horizontal canto esquerdo
2283
     * @param float $y Posição vertical canto superior
2284
     *
2285
     * @return float Posição vertical final
2286
     */
2287
    protected function transporte($x, $y)
2288
    {
2289
        $oldX = $x;
2290
        if ($this->orientacao == 'P') {
2291
            $maxW = $this->wPrint;
2292
        } else {
2293
            $maxW = $this->wPrint - $this->wCanhoto;
2294
        }
2295
        //#####################################################################
2296
        //TRANSPORTADOR / VOLUMES TRANSPORTADOS
2297
        $texto = "TRANSPORTADOR / VOLUMES TRANSPORTADOS";
2298
        $w     = $maxW;
2299
        $h     = 7;
2300
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2301
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2302
        //NOME / RAZÃO SOCIAL
2303
        $w1    = $maxW * 0.29;
2304
        $y     += 3;
2305
        $texto = 'NOME / RAZÃO SOCIAL';
2306
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2307
        $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2308
        if (isset($this->transporta)) {
2309
            $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue)
2310
                ? $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue
2311
                : '';
2312
        } else {
2313
            $texto = '';
2314
        }
2315
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2316
        $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2317
        //FRETE POR CONTA
2318
        $x     += $w1;
2319
        $w2    = $maxW * 0.15;
2320
        $texto = 'FRETE';
2321
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2322
        $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2323
        $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue)
2324
            ? $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue
2325
            : '0';
2326
        switch ($tipoFrete) {
2327
            case 0:
2328
                $texto = "0-Por conta do Rem";
2329
                break;
2330
            case 1:
2331
                $texto = "1-Por conta do Dest";
2332
                break;
2333
            case 2:
2334
                $texto = "2-Por conta de Terceiros";
2335
                break;
2336
            case 3:
2337
                $texto = "3-Próprio por conta do Rem";
2338
                break;
2339
            case 4:
2340
                $texto = "4-Próprio por conta do Dest";
2341
                break;
2342
            case 9:
2343
                $texto = "9-Sem Transporte";
2344
                break;
2345
        }
2346
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2347
        $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'C', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2348
        //CÓDIGO ANTT
2349
        $x     += $w2;
2350
        $texto = 'CÓDIGO ANTT';
2351
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2352
        $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2353
        if (isset($this->veicTransp)) {
2354
            $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue)
2355
                ? $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue
2356
                : '';
2357
        } else {
2358
            $texto = '';
2359
        }
2360
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2361
        $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2362
        //PLACA DO VEÍC
2363
        $x     += $w2;
2364
        $texto = 'PLACA DO VEÍCULO';
2365
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2366
        $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2367
        if (isset($this->veicTransp)) {
2368
            $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue)
2369
                ? $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue
2370
                : '';
2371
        } elseif (isset($this->reboque)) {
2372
            $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue)
2373
                ? $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue
2374
                : '';
2375
        } else {
2376
            $texto = '';
2377
        }
2378
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2379
        $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2380
        //UF
2381
        $x     += $w2;
2382
        $w3    = round($maxW * 0.04, 0);
2383
        $texto = 'UF';
2384
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2385
        $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2386
        if (isset($this->veicTransp)) {
2387
            $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue)
2388
                ? $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue
2389
                : '';
2390
        } elseif (isset($this->reboque)) {
2391
            $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue)
2392
                ? $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue
2393
                : '';
2394
        } else {
2395
            $texto = '';
2396
        }
2397
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2398
        $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2399
        //CNPJ / CPF
2400
        $x     += $w3;
2401
        $w     = $maxW - ($w1 + 3 * $w2 + $w3);
2402
        $texto = 'CNPJ / CPF';
2403
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2404
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2405
        if (isset($this->transporta)) {
2406
            $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue)
2407
                ? $this->formatField(
2408
                    $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,
2409
                    "##.###.###/####-##"
2410
                )
2411
                : '';
2412
            if ($texto == '') {
2413
                $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue)
2414
                    ? $this->formatField(
2415
                        $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue,
2416
                        "###.###.###-##"
2417
                    )
2418
                    : '';
2419
            }
2420
        } else {
2421
            $texto = '';
2422
        }
2423
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2424
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2425
        //#####################################################################
2426
        //ENDEREÇO
2427
        $y     += $h;
2428
        $x     = $oldX;
2429
        $h     = 7;
2430
        $w1    = $maxW * 0.44;
2431
        $texto = 'ENDEREÇO';
2432
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2433
        $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2434
        if (isset($this->transporta)) {
2435
            $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue)
2436
                ? $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue
2437
                : '';
2438
        } else {
2439
            $texto = '';
2440
        }
2441
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2442
        $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2443
        //MUNICÍPIO
2444
        $x     += $w1;
2445
        $w2    = round($maxW * 0.30, 0);
2446
        $texto = 'MUNICÍPIO';
2447
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2448
        $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2449
        if (isset($this->transporta)) {
2450
            $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue)
2451
                ? $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue
2452
                : '';
2453
        } else {
2454
            $texto = '';
2455
        }
2456
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2457
        $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2458
        //UF
2459
        $x     += $w2;
2460
        $w3    = round($maxW * 0.04, 0);
2461
        $texto = 'UF';
2462
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2463
        $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2464
        if (isset($this->transporta)) {
2465
            $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue)
2466
                ? $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue
2467
                : '';
2468
        } else {
2469
            $texto = '';
2470
        }
2471
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2472
        $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2473
        //INSCRIÇÃO ESTADUAL
2474
        $x     += $w3;
2475
        $w     = $maxW - ($w1 + $w2 + $w3);
2476
        $texto = 'INSCRIÇÃO ESTADUAL';
2477
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2478
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2479
        $texto = '';
2480
        if (isset($this->transporta)) {
2481
            if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2482
                $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue;
2483
            }
2484
        }
2485
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2486
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2487
        //Tratar Multiplos volumes
2488
        $volumes     = $this->transp->getElementsByTagName('vol');
2489
        $quantidade  = 0;
2490
        $especie     = '';
2491
        $marca       = '';
2492
        $numero      = '';
2493
        $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...
2494
        $pesoBruto   = 0;
2495
        $pesoLiquido = 0;
2496
        foreach ($volumes as $volume) {
2497
            $quantidade  += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2498
                $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0;
2499
            $pesoBruto   += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2500
                $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0;
2501
            $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2502
                $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0;
2503
            $texto       = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2504
                $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';
2505
            if ($texto != $especie && $especie != '') {
2506
                //tem várias especies
2507
                $especie = 'VARIAS';
2508
            } else {
2509
                $especie = $texto;
2510
            }
2511
            $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue)
2512
                ? $this->transp->getElementsByTagName("marca")->item(0)->nodeValue
2513
                : '';
2514
            if ($texto != $marca && $marca != '') {
2515
                //tem várias especies
2516
                $marca = 'VARIAS';
2517
            } else {
2518
                $marca = $texto;
2519
            }
2520
            $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue)
2521
                ? $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue
2522
                : '';
2523
            if ($texto != $numero && $numero != '') {
2524
                //tem várias especies
2525
                $numero = 'VARIOS';
2526
            } else {
2527
                $numero = $texto;
2528
            }
2529
        }
2530
2531
        //#####################################################################
2532
        //QUANTIDADE
2533
        $y     += $h;
2534
        $x     = $oldX;
2535
        $h     = 7;
2536
        $w1    = round($maxW * 0.10, 0);
2537
        $texto = 'QUANTIDADE';
2538
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2539
        $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2540
        if (! empty($quantidade)) {
2541
            $texto = $quantidade;
2542
            $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2543
            $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2544
        }
2545
        //ESPÉCIE
2546
        $x     += $w1;
2547
        $w2    = round($maxW * 0.17, 0);
2548
        $texto = 'ESPÉCIE';
2549
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2550
        $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2551
        $texto = $especie;
2552
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2553
        $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2554
        //MARCA
2555
        $x     += $w2;
2556
        $texto = 'MARCA';
2557
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2558
        $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2559
        $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2560
            $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2561
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2562
        $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2563
        //NUMERAÇÃO
2564
        $x     += $w2;
2565
        $texto = 'NUMERAÇÃO';
2566
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2567
        $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2568
        $texto = $numero;
2569
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2570
        $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2571
        //PESO BRUTO
2572
        $x     += $w2;
2573
        $w3    = round($maxW * 0.20, 0);
2574
        $texto = 'PESO BRUTO';
2575
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2576
        $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2577
        if (is_numeric($pesoBruto) && $pesoBruto > 0) {
2578
            $texto = number_format($pesoBruto, 3, ",", ".");
2579
        } else {
2580
            $texto = '';
2581
        }
2582
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2583
        $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'R', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2584
        //PESO LÍQUIDO
2585
        $x     += $w3;
2586
        $w     = $maxW - ($w1 + 3 * $w2 + $w3);
2587
        $texto = 'PESO LÍQUIDO';
2588
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2589
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2590
        if (is_numeric($pesoLiquido) && $pesoLiquido > 0) {
2591
            $texto = number_format($pesoLiquido, 3, ",", ".");
2592
        } else {
2593
            $texto = '';
2594
        }
2595
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2596
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2597
2598
        return ($y + $h);
2599
    } //fim transporte
2600
2601
2602
    protected function descricaoProdutoHelper($origem, $campo, $formato)
2603
    {
2604
        $valor_original = $origem->getElementsByTagName($campo)->item(0);
2605
        if (! isset($valor_original)) {
2606
            return "";
2607
        }
2608
        $valor_original = $valor_original->nodeValue;
2609
        $valor          = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2610
2611
        if ($valor != "") {
2612
            return sprintf($formato, $valor);
2613
        }
2614
2615
        return "";
2616
    }
2617
2618
    /**
2619
     * descricaoProduto
2620
     * Monta a string de descrição de cada Produto
2621
     *
2622
     * @name   descricaoProduto
2623
     *
2624
     * @param DOMNode itemProd
2625
     *
2626
     * @return string descricao do produto
2627
     */
2628
    protected function descricaoProduto($itemProd)
2629
    {
2630
        $prod       = $itemProd->getElementsByTagName('prod')->item(0);
2631
        $ICMS       = $itemProd->getElementsByTagName("ICMS")->item(0);
2632
        $ICMSUFDest = $itemProd->getElementsByTagName("ICMSUFDest")->item(0);
2633
        $impostos   = '';
2634
2635
        if (! empty($ICMS)) {
2636
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vBCFCP", " BcFcp=%s");
2637
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pFCP", " pFcp=%s%%");
2638
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vFCP", " vFcp=%s");
2639
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pRedBC", " pRedBC=%s%%");
2640
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pMVAST", " IVA/MVA=%s%%");
2641
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pICMSST", " pIcmsSt=%s%%");
2642
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vBCST", " BcIcmsSt=%s");
2643
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vICMSST", " vIcmsSt=%s");
2644
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vBCFCPST", " BcFcpSt=%s");
2645
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pFCPST", " pFcpSt=%s%%");
2646
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vFCPST", " vFcpSt=%s");
2647
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vBCSTRet", " Retido na compra: BASE ICMS ST=%s");
2648
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pST", " pSt=%s");
2649
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vICMSSTRet", " VALOR ICMS ST=%s");
2650
        }
2651
        if (! empty($ICMSUFDest)) {
2652
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "pFCPUFDest", " pFCPUFDest=%s%%");
2653
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "pICMSUFDest", " pICMSUFDest=%s%%");
2654
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "pICMSInterPart", " pICMSInterPart=%s%%");
2655
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vFCPUFDest", " vFCPUFDest=%s");
2656
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
2657
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
2658
        }
2659
        $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue)
2660
            ? substr(
2661
                $this->anfaveaDANFE($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue),
2662
                0,
2663
                500
2664
            )
2665
            : '';
2666
        if (! empty($infAdProd)) {
2667
            $infAdProd = trim($infAdProd);
2668
            $infAdProd .= ' ';
2669
        }
2670
        $loteTxt = '';
2671
        $rastro  = $prod->getElementsByTagName("med");
0 ignored issues
show
Unused Code introduced by
$rastro 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...
2672
        if (! empty($prod->getElementsByTagName("rastro"))) {
2673
            $rastro = $prod->getElementsByTagName("rastro");
2674
            $i      = 0;
2675
            while ($i < $rastro->length) {
2676
                $dFab = $this->getTagDate($rastro->item($i), 'dFab');
2677
                $datafab = " Fab: " . $dFab;
2678
                $dVal = $this->getTagDate($rastro->item($i), 'dVal');
2679
                $dataval = " Val: " . $dVal;
2680
2681
                $loteTxt .= $this->getTagValue($rastro->item($i), 'nLote', ' Lote: ');
2682
                $loteTxt .= $this->getTagValue($rastro->item($i), 'qLote', ' Quant: ');
2683
                $loteTxt .= $datafab; //$this->getTagDate($rastro->item($i), 'dFab', ' Fab: ');
2684
                $loteTxt .= $dataval; //$this->getTagDate($rastro->item($i), 'dVal', ' Val: ');
2685
                $loteTxt .= $this->getTagValue($rastro->item($i), 'vPMC', ' PMC: ');
2686
                $i ++;
2687
            }
2688
            if ($loteTxt != '') {
2689
                $loteTxt .= ' ';
2690
            }
2691
        }
2692
        //NT2013.006 FCI
2693
        $nFCI   = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2694
            ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2695
        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2696
        $texto  = $prod->getElementsByTagName("xProd")->item(0)->nodeValue
2697
            . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
2698
        //decodifica os caracteres html no xml
2699
        $texto = html_entity_decode($texto);
2700
        if ($this->descProdQuebraLinha) {
2701
            $texto = str_replace(";", "\n", $texto);
2702
        }
2703
2704
        return $texto;
2705
    }
2706
2707
    /**
2708
     * itens
2709
     * Monta o campo de itens da DANFE (retrato e paisagem)
2710
     *
2711
     * @name   itens
2712
     *
2713
     * @param float $x       Posição horizontal canto esquerdo
2714
     * @param float $y       Posição vertical canto superior
2715
     * @param float $nInicio Número do item inicial
2716
     * @param float $max     Número do item final
0 ignored issues
show
Bug introduced by
There is no parameter named $max. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
2717
     * @param float $hmax    Altura máxima do campo de itens em mm
2718
     *
2719
     * @return float Posição vertical final
2720
     */
2721
    protected function itens($x, $y, &$nInicio, $hmax, $pag = 0, $totpag = 0, $hCabecItens = 7)
2722
    {
2723
        $oldX = $x;
2724
        $oldY = $y;
2725
        $totItens = $this->det->length;
0 ignored issues
show
Bug introduced by
The property length does not seem to exist in DOMNode.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
2726
        //#####################################################################
2727
        //DADOS DOS PRODUTOS / SERVIÇOS
2728
        $texto = "DADOS DOS PRODUTOS / SERVIÇOS";
2729
        if ($this->orientacao == 'P') {
2730
            $w = $this->wPrint;
2731
        } else {
2732
            if ($nInicio < 2) { // primeira página
2733
                $w = $this->wPrint - $this->wCanhoto;
2734
            } else { // páginas seguintes
2735
                $w = $this->wPrint;
2736
            }
2737
        }
2738
        $h     = 4;
2739
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2740
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2741
        $y += 3;
2742
        //desenha a caixa dos dados dos itens da NF
2743
        $hmax  += 1;
2744
        $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...
2745
        $this->pdf->textBox($x, $y, $w, $hmax);
2746
        //##################################################################################
2747
        // cabecalho LOOP COM OS DADOS DOS PRODUTOS
2748
        //CÓDIGO PRODUTO
2749
        $texto = "CÓDIGO PRODUTO";
2750
        $w1    = round($w * 0.09, 0);
2751
        $h     = 4;
2752
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2753
        $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2754
        $this->pdf->line($x + $w1, $y, $x + $w1, $y + $hmax);
2755
        //DESCRIÇÃO DO PRODUTO / SERVIÇO
2756
        $x     += $w1;
2757
        $w2    = round($w * 0.25, 0);
2758
        $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO';
2759
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2760
        $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2761
        $this->pdf->line($x + $w2, $y, $x + $w2, $y + $hmax);
2762
        //NCM/SH
2763
        $x     += $w2;
2764
        $w3    = round($w * 0.06, 0);
2765
        $texto = 'NCM/SH';
2766
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2767
        $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2768
        $this->pdf->line($x + $w3, $y, $x + $w3, $y + $hmax);
2769
        //O/CST ou O/CSOSN
2770
        $x     += $w3;
2771
        $w4    = round($w * 0.05, 0);
2772
        $texto = 'O/CST'; // CRT = 2 ou CRT = 3
2773
        if ($this->getTagValue($this->emit, 'CRT') == '1') {
2774
            $texto = 'O/CSOSN';//Regime do Simples CRT = 1
2775
        }
2776
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2777
        $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2778
        $this->pdf->line($x + $w4, $y, $x + $w4, $y + $hmax);
2779
        //CFOP
2780
        $x     += $w4;
2781
        $w5    = round($w * 0.04, 0);
2782
        $texto = 'CFOP';
2783
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2784
        $this->pdf->textBox($x, $y, $w5, $h, $texto, $aFont, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2785
        $this->pdf->line($x + $w5, $y, $x + $w5, $y + $hmax);
2786
        //UN
2787
        $x     += $w5;
2788
        $w6    = round($w * 0.03, 0);
2789
        $texto = 'UN';
2790
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2791
        $this->pdf->textBox($x, $y, $w6, $h, $texto, $aFont, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2792
        $this->pdf->line($x + $w6, $y, $x + $w6, $y + $hmax);
2793
        //QUANT
2794
        $x     += $w6;
2795
        $w7    = round($w * 0.08, 0);
2796
        $texto = 'QUANT';
2797
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2798
        $this->pdf->textBox($x, $y, $w7, $h, $texto, $aFont, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2799
        $this->pdf->line($x + $w7, $y, $x + $w7, $y + $hmax);
2800
        //VALOR UNIT
2801
        $x     += $w7;
2802
        $w8    = round($w * 0.06, 0);
2803
        $texto = 'VALOR UNIT';
2804
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2805
        $this->pdf->textBox($x, $y, $w8, $h, $texto, $aFont, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2806
        $this->pdf->line($x + $w8, $y, $x + $w8, $y + $hmax);
2807
        //VALOR TOTAL
2808
        $x     += $w8;
2809
        $w9    = round($w * 0.06, 0);
2810
        $texto = 'VALOR TOTAL';
2811
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2812
        $this->pdf->textBox($x, $y, $w9, $h, $texto, $aFont, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2813
        $this->pdf->line($x + $w9, $y, $x + $w9, $y + $hmax);
2814
        //VALOR DESCONTO
2815
        $x     += $w9;
2816
        $w10   = round($w * 0.05, 0);
2817
        $texto = 'VALOR DESC';
2818
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2819
        $this->pdf->textBox($x, $y, $w10, $h, $texto, $aFont, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2820
        $this->pdf->line($x + $w10, $y, $x + $w10, $y + $hmax);
2821
        //B.CÁLC ICMS
2822
        $x     += $w10;
2823
        $w11   = round($w * 0.06, 0);
2824
        $texto = 'B.CÁLC ICMS';
2825
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2826
        $this->pdf->textBox($x, $y, $w11, $h, $texto, $aFont, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2827
        $this->pdf->line($x + $w11, $y, $x + $w11, $y + $hmax);
2828
        //VALOR ICMS
2829
        $x     += $w11;
2830
        $w12   = round($w * 0.06, 0);
2831
        $texto = 'VALOR ICMS';
2832
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2833
        $this->pdf->textBox($x, $y, $w12, $h, $texto, $aFont, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2834
        $this->pdf->line($x + $w12, $y, $x + $w12, $y + $hmax);
2835
        //VALOR IPI
2836
        $x     += $w12;
2837
        $w13   = round($w * 0.05, 0);
2838
        $texto = 'VALOR IPI';
2839
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2840
        $this->pdf->textBox($x, $y, $w13, $h, $texto, $aFont, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2841
        $this->pdf->line($x + $w13, $y, $x + $w13, $y + $hmax);
2842
        //ALÍQ. ICMS
2843
        $x     += $w13;
2844
        $w14   = round($w * 0.04, 0);
2845
        $texto = 'ALÍQ. ICMS';
2846
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2847
        $this->pdf->textBox($x, $y, $w14, $h, $texto, $aFont, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2848
        $this->pdf->line($x + $w14, $y, $x + $w14, $y + $hmax);
2849
        //ALÍQ. IPI
2850
        $x     += $w14;
2851
        $w15   = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13 + $w14);
2852
        $texto = 'ALÍQ. IPI';
2853
        $this->pdf->textBox($x, $y, $w15, $h, $texto, $aFont, 'C', 'C', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2854
        $this->pdf->line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1);
2855
        $y += 5;
2856
        //##################################################################################
2857
        // LOOP COM OS DADOS DOS PRODUTOS
2858
        $i      = 0;
2859
        $hUsado = $hCabecItens;
2860
        $aFont  = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
2861
2862
        foreach ($this->det as $d) {
0 ignored issues
show
Bug introduced by
The expression $this->det of type object<DOMNode> is not traversable.
Loading history...
2863
            if ($i >= $nInicio) {
2864
                $thisItem = $this->det->item($i);
2865
                //carrega as tags do item
2866
                $prod         = $thisItem->getElementsByTagName("prod")->item(0);
2867
                $imposto      = $this->det->item($i)->getElementsByTagName("imposto")->item(0);
2868
                $ICMS         = $imposto->getElementsByTagName("ICMS")->item(0);
2869
                $IPI          = $imposto->getElementsByTagName("IPI")->item(0);
2870
                $textoProduto = $this->descricaoProduto($thisItem);
2871
2872
2873
                // Posição y dos dados das unidades tributaveis.
2874
                $yTrib = $this->pdf->fontSize + .5;
2875
2876
                $uCom = $prod->getElementsByTagName("uCom")->item(0)->nodeValue;
2877
                $vUnCom = $prod->getElementsByTagName("vUnCom")->item(0)->nodeValue;
2878
                $uTrib = $prod->getElementsByTagName("uTrib")->item(0);
2879
                $qTrib = $prod->getElementsByTagName("qTrib")->item(0);
2880
                $cfop = $prod->getElementsByTagName("CFOP")->item(0)->nodeValue;
0 ignored issues
show
Unused Code introduced by
$cfop 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...
2881
                $vUnTrib = !empty($prod->getElementsByTagName("vUnTrib")->item(0)->nodeValue)
2882
                    ? $prod->getElementsByTagName("vUnTrib")->item(0)->nodeValue
2883
                    : 0;
2884
                // A Configuração serve para informar se irá exibir
2885
                //   de forma obrigatória, estando diferente ou não,
2886
                //   a unidade de medida tributária.
2887
                // ========
2888
                // A Exibição será realizada sempre que a unidade comercial for
2889
                //   diferente da unidade de medida tributária.
2890
                // "Nas situações em que o valor unitário comercial for diferente do valor unitário tributável,
2891
                //   ambas as informações deverão estar expressas e identificadas no DANFE, podendo ser
2892
                //   utilizada uma das linhas adicionais previstas, ou o campo de informações adicionais."
2893
                // > Manual Integração - Contribuinte 4.01 - NT2009.006, Item 7.1.5, página 91.
2894
                $mostrarUnidadeTributavel = (
2895
                    !$this->ocultarUnidadeTributavel
2896
                    && !empty($uTrib)
2897
                    && !empty($qTrib)
2898
                    && number_format($vUnCom, 2, ',', '') !== number_format($vUnTrib, 2, ',', '')
2899
                );
2900
2901
                // Informação sobre unidade de medida tributavel.
2902
                // Se não for para exibir a unidade de medida tributavel, então
2903
                // A Escrita irá começar em 0.
2904
                if (! $mostrarUnidadeTributavel) {
2905
                    $yTrib = 0;
2906
                }
2907
                $h = $this->calculeHeight($thisItem, $mostrarUnidadeTributavel);
2908
                $hUsado += $h;
2909
2910
                $yTrib += $y;
2911
                $diffH = $hmax - $hUsado;
2912
2913
                if ($pag != $totpag) {
2914
                    if (1 > $diffH && $i < $totItens) {
2915
                        //ultrapassa a capacidade para uma única página
2916
                        //o restante dos dados serão usados nas proximas paginas
2917
                        $nInicio = $i;
2918
                        break;
2919
                    }
2920
                }
2921
                $y_linha = $y + $h;
2922
                // linha entre itens
2923
                $this->pdf->dashedHLine($oldX, $y_linha, $w, 0.1, 120);
2924
                //corrige o x
2925
                $x = $oldX;
2926
                //codigo do produto
2927
                $guup  = $i + 1;
0 ignored issues
show
Unused Code introduced by
$guup 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...
2928
                $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue;
2929
                $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2930
                $x += $w1;
2931
                //DESCRIÇÃO
2932
                if ($this->orientacao == 'P') {
2933
                    $this->pdf->textBox($x, $y, $w2, $h, $textoProduto, $aFont, 'T', 'L', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2934
                } else {
2935
                    $this->pdf->textBox($x, $y, $w2, $h, $textoProduto, $aFont, 'T', 'L', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2936
                }
2937
                $x += $w2;
2938
                //NCM
2939
                $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2940
                    $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';
2941
                $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2942
                $x += $w3;
2943
                //CST
2944
                if (isset($ICMS)) {
2945
                    $origem = $this->getTagValue($ICMS, "orig");
2946
                    $cst    = $this->getTagValue($ICMS, "CST");
2947
                    $csosn  = $this->getTagValue($ICMS, "CSOSN");
2948
                    $texto  = $origem . $cst . $csosn;
2949
                    $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'T', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2950
                }
2951
                //CFOP
2952
                $x     += $w4;
2953
                $texto = $prod->getElementsByTagName("CFOP")->item(0)->nodeValue;
2954
                $this->pdf->textBox($x, $y, $w5, $h, $texto, $aFont, 'T', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2955
                //Unidade
2956
                $x     += $w5;
2957
                $texto = $uCom;
2958
                $this->pdf->textBox($x, $y, $w6, $h, $texto, $aFont, 'T', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2959
                //Unidade de medida tributável
2960
                $qTrib = $prod->getElementsByTagName("qTrib")->item(0)->nodeValue;
0 ignored issues
show
Unused Code introduced by
$qTrib 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...
2961
                if ($mostrarUnidadeTributavel) {
2962
                    $texto = $uTrib->nodeValue;
2963
                    $this->pdf->textBox($x, $yTrib, $w6, $h, $texto, $aFont, 'T', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2964
                }
2965
                $x += $w6;
2966
                if ($this->orientacao == 'P') {
2967
                    $alinhamento = 'R';
2968
                } else {
2969
                    $alinhamento = 'R';
2970
                }
2971
                // QTDADE
2972
                $qCom  = $prod->getElementsByTagName("qCom")->item(0);
2973
                $texto = number_format($qCom->nodeValue, $this->qComCasasDec, ",", ".");
2974
                $this->pdf->textBox($x, $y, $w7, $h, $texto, $aFont, 'T', $alinhamento, 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2975
                // QTDADE Tributável
2976
                if ($mostrarUnidadeTributavel) {
2977
                    $qTrib = $prod->getElementsByTagName("qTrib")->item(0);
2978
                    if (! empty($qTrib)) {
2979
                        $texto = number_format($qTrib->nodeValue, $this->qComCasasDec, ",", ".");
2980
                        $this->pdf->textBox($x, $yTrib, $w7, $h, $texto, $aFont, 'T', $alinhamento, 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2981
                    }
2982
                }
2983
                $x += $w7;
2984
                // Valor Unitário
2985
                $vUnCom = $prod->getElementsByTagName("vUnCom")->item(0);
2986
                $texto  = number_format($vUnCom->nodeValue, $this->vUnComCasasDec, ",", ".");
2987
                $this->pdf->textBox($x, $y, $w8, $h, $texto, $aFont, 'T', $alinhamento, 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2988
                // Valor Unitário Tributável
2989
                if ($mostrarUnidadeTributavel) {
2990
                    $vUnTrib = $prod->getElementsByTagName("vUnTrib")->item(0);
2991
                    if (! empty($vUnTrib)) {
2992
                        $texto = number_format($vUnTrib->nodeValue, $this->vUnComCasasDec, ",", ".");
2993
                        $this->pdf->textBox($x, $yTrib, $w8, $h, $texto, $aFont, 'T', $alinhamento, 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
2994
                    }
2995
                }
2996
                $x += $w8;
2997
                // Valor do Produto
2998
                $texto = "";
2999
                if (is_numeric($prod->getElementsByTagName("vProd")->item(0)->nodeValue)) {
3000
                    $texto = number_format($prod->getElementsByTagName("vProd")->item(0)->nodeValue, 2, ",", ".");
3001
                }
3002
                $this->pdf->textBox($x, $y, $w9, $h, $texto, $aFont, 'T', $alinhamento, 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3003
                $x += $w9;
3004
                //Valor do Desconto
3005
                $vdesc = ! empty($prod->getElementsByTagName("vDesc")->item(0)->nodeValue)
3006
                    ? $prod->getElementsByTagName("vDesc")->item(0)->nodeValue : 0;
3007
3008
                $texto = number_format($vdesc, 2, ",", ".");
3009
                $this->pdf->textBox($x, $y, $w10, $h, $texto, $aFont, 'T', $alinhamento, 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3010
                //Valor da Base de calculo
3011
                $x += $w10;
3012
                if (isset($ICMS)) {
3013
                    $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue)
3014
                        ? number_format(
3015
                            $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue,
3016
                            2,
3017
                            ",",
3018
                            "."
3019
                        )
3020
                        : '0,00';
3021
                    $this->pdf->textBox($x, $y, $w11, $h, $texto, $aFont, 'T', $alinhamento, 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3022
                }
3023
                //Valor do ICMS
3024
                $x += $w11;
3025
                if (isset($ICMS)) {
3026
                    $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue)
3027
                        ? number_format(
3028
                            $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue,
3029
                            2,
3030
                            ",",
3031
                            "."
3032
                        )
3033
                        : '0,00';
3034
                    $this->pdf->textBox($x, $y, $w12, $h, $texto, $aFont, 'T', $alinhamento, 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3035
                }
3036
                //Valor do IPI
3037
                $x += $w12;
3038
                if (isset($IPI)) {
3039
                    $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue)
3040
                        ? number_format(
3041
                            $IPI->getElementsByTagName("vIPI")->item(0)->nodeValue,
3042
                            2,
3043
                            ",",
3044
                            "."
3045
                        )
3046
                        : '';
3047
                } else {
3048
                    $texto = '';
3049
                }
3050
                $this->pdf->textBox($x, $y, $w13, $h, $texto, $aFont, 'T', $alinhamento, 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3051
                // %ICMS
3052
                $x += $w13;
3053
                if (isset($ICMS)) {
3054
                    $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue)
3055
                        ? number_format(
3056
                            $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue,
3057
                            2,
3058
                            ",",
3059
                            "."
3060
                        )
3061
                        : '0,00';
3062
                    $this->pdf->textBox($x, $y, $w14, $h, $texto, $aFont, 'T', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3063
                }
3064
                //%IPI
3065
                $x += $w14;
3066
                if (isset($IPI)) {
3067
                    $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue)
3068
                        ? number_format(
3069
                            $IPI->getElementsByTagName("pIPI")->item(0)->nodeValue,
3070
                            2,
3071
                            ",",
3072
                            "."
3073
                        )
3074
                        : '';
3075
                } else {
3076
                    $texto = '';
3077
                }
3078
                $this->pdf->textBox($x, $y, $w15, $h, $texto, $aFont, 'T', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3079
3080
3081
                // Dados do Veiculo Somente para veiculo 0 Km
3082
                $veicProd = $prod->getElementsByTagName("veicProd")->item(0);
3083
                // Tag somente é gerada para veiculo 0k, e só é permitido um veiculo por NF-e por conta do detran
3084
                // Verifica se a Tag existe
3085
                if (! empty($veicProd)) {
3086
                    $this->dadosItenVeiculoDANFE($oldX, $y, $nInicio, $h, $prod);
3087
                }
3088
3089
3090
                $y += $h;
3091
                $i ++;
3092
                //incrementa o controle dos itens processados.
3093
                $this->qtdeItensProc ++;
3094
            } else {
3095
                $i ++;
3096
            }
3097
        }
3098
3099
        return $oldY + $hmax;
3100
    }
3101
3102
3103
    /**
3104
     * dadosItenVeiculoDANFE
3105
     * Coloca os dados do veiculo abaixo do item da NFe. (retrato e paisagem)
3106
     *
3107
     * @param float  $x    Posição horizontal
3108
     *                     canto esquerdo
3109
     * @param float  $y    Posição vertical
3110
     *                     canto superior
3111
     * @param        $nInicio
3112
     * @param float  $h    altura do campo
3113
     * @param object $prod Contendo todos os dados do item
3114
     */
3115
3116
    protected function dadosItenVeiculoDANFE($x, $y, &$nInicio, $h, $prod)
3117
    {
3118
        $oldX = $x;
3119
        $oldY = $y;
0 ignored issues
show
Unused Code introduced by
$oldY 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...
3120
3121
        if ($this->orientacao == 'P') {
3122
            $w = $this->wPrint;
3123
        } else {
3124
            if ($nInicio < 2) { // primeira página
3125
                $w = $this->wPrint - $this->wCanhoto;
3126
            } else { // páginas seguintes
3127
                $w = $this->wPrint;
3128
            }
3129
        }
3130
3131
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
3132
3133
        $w1 = round($w * 0.09, 0);
3134
3135
        // Tabela Renavam Combustivel
3136
        $renavamCombustivel = [
3137
            1  => 'ALCOOL',
3138
            2  => 'GASOLINA',
3139
            3  => 'DIESEL',
3140
            4  => 'GASOGENIO',
3141
            5  => 'GAS METANO',
3142
            6  => 'ELETRICO/FONTE INTERNA',
3143
            7  => 'ELETRICO/FONTE EXTERNA',
3144
            8  => 'GASOL/GAS NATURAL COMBUSTIVEL',
3145
            9  => 'ALCOOL/GAS NATURAL COMBUSTIVEL',
3146
            10 => 'DIESEL/GAS NATURAL COMBUSTIVEL',
3147
            11 => 'VIDE/CAMPO/OBSERVACAO',
3148
            12 => 'ALCOOL/GAS NATURAL VEICULAR',
3149
            13 => 'GASOLINA/GAS NATURAL VEICULAR',
3150
            14 => 'DIESEL/GAS NATURAL VEICULAR',
3151
            15 => 'GAS NATURAL VEICULAR',
3152
            16 => 'ALCOOL/GASOLINA',
3153
            17 => 'GASOLINA/ALCOOL/GAS NATURAL',
3154
            18 => 'GASOLINA/ELETRICO'
3155
        ];
3156
3157
        $renavamEspecie = [
3158
            1 => 'PASSAGEIRO',
3159
            2 => 'CARGA',
3160
            3 => 'MISTO',
3161
            4 => 'CORRIDA',
3162
            5 => 'TRACAO',
3163
            6 => 'ESPECIAL',
3164
            7 => 'COLECAO'
3165
        ];
3166
3167
        $renavamTiposVeiculos = [
3168
            1  => 'BICICLETA',
3169
            2  => 'CICLOMOTOR',
3170
            3  => 'MOTONETA',
3171
            4  => 'MOTOCICLETA',
3172
            5  => 'TRICICLO',
3173
            6  => 'AUTOMOVEL',
3174
            7  => 'MICROONIBUS',
3175
            8  => 'ONIBUS',
3176
            9  => 'BONDE',
3177
            10 => 'REBOQUE',
3178
            11 => 'SEMI-REBOQUE',
3179
            12 => 'CHARRETE',
3180
            13 => 'CAMIONETA',
3181
            14 => 'CAMINHAO',
3182
            15 => 'CARROCA',
3183
            16 => 'CARRO DE MAO',
3184
            17 => 'CAMINHAO TRATOR',
3185
            18 => 'TRATOR DE RODAS',
3186
            19 => 'TRATOR DE ESTEIRAS',
3187
            20 => 'TRATOR MISTO',
3188
            21 => 'QUADRICICLO',
3189
            22 => 'CHASSI/PLATAFORMA',
3190
            23 => 'CAMINHONETE',
3191
            24 => 'SIDE-CAR',
3192
            25 => 'UTILITARIO',
3193
            26 => 'MOTOR-CASA'
3194
        ];
3195
3196
        $renavamTipoPintura = [
0 ignored issues
show
Unused Code introduced by
$renavamTipoPintura 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...
3197
            'F' => 'FOSCA',
3198
            'S' => 'SÓLIDA',
3199
            'P' => 'PEROLIZADA',
3200
            'M' => 'METALICA',
3201
        ];
3202
3203
        $veicProd = $prod->getElementsByTagName("veicProd")->item(0);
3204
3205
        $veiculoChassi     = $veicProd->getElementsByTagName("chassi")->item(0)->nodeValue;
3206
        $veiculoCor        = $veicProd->getElementsByTagName("xCor")->item(0)->nodeValue;
3207
        $veiculoCilindrada = $veicProd->getElementsByTagName("cilin")->item(0)->nodeValue;
3208
        $veiculoCmkg       = $veicProd->getElementsByTagName("CMT")->item(0)->nodeValue;
3209
        $veiculoTipo       = $veicProd->getElementsByTagName("tpVeic")->item(0)->nodeValue;
3210
3211
        $veiculoMotor       = $veicProd->getElementsByTagName("nMotor")->item(0)->nodeValue;
3212
        $veiculoRenavam     = $veicProd->getElementsByTagName("cMod")->item(0)->nodeValue;
3213
        $veiculoHp          = $veicProd->getElementsByTagName("pot")->item(0)->nodeValue;
3214
        $veiculoPlaca       = ''; //$veiculo->getElementsByTagName("CMT")->item(0)->nodeValue;
3215
        $veiculoTipoPintura = $veicProd->getElementsByTagName("tpPint")->item(0)->nodeValue;
3216
        $veiculoMarcaModelo = $prod->getElementsByTagName("xProd")->item(0)->nodeValue;
3217
        $veiculoEspecie     = $veicProd->getElementsByTagName("espVeic")->item(0)->nodeValue;
3218
        $veiculoCombustivel = $veicProd->getElementsByTagName("tpComb")->item(0)->nodeValue;
3219
        $veiculoSerial      = $veicProd->getElementsByTagName("nSerie")->item(0)->nodeValue;
3220
        $veiculoFabricacao  = $veicProd->getElementsByTagName("anoFab")->item(0)->nodeValue;
3221
        $veiculoModelo      = $veicProd->getElementsByTagName("anoMod")->item(0)->nodeValue;
3222
        $veiculoDistancia   = $veicProd->getElementsByTagName("dist")->item(0)->nodeValue;
3223
3224
        $x = $oldX;
3225
3226
        $yVeic = $y + $h;
3227
        $texto = 'Chassi: ............: ' . $veiculoChassi;
3228
        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3229
        $yVeic += $h;
3230
        $texto = 'Cor...................: ' . $veiculoCor;
3231
        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3232
        $yVeic += $h;
3233
        $texto = 'Cilindrada........: ' . $veiculoCilindrada;
3234
        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3235
        $yVeic += $h;
3236
        $texto = 'Cmkg...............: ' . $veiculoCmkg;
3237
        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3238
        $yVeic += $h;
3239
        $texto = 'Tipo.................: ' . ($renavamTiposVeiculos[intval($veiculoTipo)] ?? $veiculoTipo);
3240
        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3241
        $yVeic = $y + $h;
3242
        $xVeic = $x + 65;
3243
        $texto = 'Nº Motor: .........: ' . $veiculoMotor;
3244
        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3245
        $yVeic += $h;
3246
        $texto = 'Renavam...........: ' . $veiculoRenavam;
3247
        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3248
        $yVeic += $h;
3249
        $texto = 'HP.....................: ' . $veiculoHp;
3250
        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3251
        $yVeic += $h;
3252
        $texto = 'Placa.................: ' . $veiculoPlaca;
3253
        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3254
        $yVeic += $h;
3255
        $texto = 'Tipo Pintura......: ' . ($renavamEspecie[intval($veiculoTipoPintura)] ?? $veiculoTipoPintura);
3256
        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3257
        $yVeic = $y + $h;
3258
        $xVeic = $xVeic + 55;
3259
        $texto = 'Marca / Modelo.....: ' . $veiculoMarcaModelo;
3260
        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3261
        $yVeic += $h;
3262
        $texto = 'Especie..................: ' . ($renavamEspecie[intval($veiculoEspecie)] ?? $veiculoEspecie);
3263
        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3264
        $yVeic += $h;
3265
        $texto = 'Combustivel..........: ' . ($renavamCombustivel[intval($veiculoCombustivel)] ?? $veiculoCombustivel);
3266
        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3267
        $yVeic += $h;
3268
        $texto = 'Serial.....................: ' . $veiculoSerial;
3269
        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3270
        $yVeic += $h;
3271
        $texto = 'Ano Fab/Mod........: ' . $veiculoFabricacao . '/' . $veiculoModelo;
3272
        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3273
        $yVeic += $h;
3274
        $texto = 'Distancia Entre Eixos(mm)..: ' . $veiculoDistancia;
3275
        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3276
    }
3277
3278
    /**
3279
     * issqn
3280
     * Monta o campo de serviços do DANFE
3281
     *
3282
     * @name   issqn (retrato e paisagem)
3283
     *
3284
     * @param float $x Posição horizontal canto esquerdo
3285
     * @param float $y Posição vertical canto superior
3286
     *
3287
     * @return float Posição vertical final
3288
     */
3289
    protected function issqn($x, $y)
3290
    {
3291
        $oldX = $x;
0 ignored issues
show
Unused Code introduced by
$oldX 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...
3292
        //#####################################################################
3293
        //CÁLCULO DO ISSQN
3294
        $texto = "CÁLCULO DO ISSQN";
3295
        $w     = $this->wPrint;
3296
        $h     = 7;
3297
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
3298
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3299
        //INSCRIÇÃO MUNICIPAL
3300
        $y     += 3;
3301
        $w     = round($this->wPrint * 0.23, 0);
3302
        $texto = 'INSCRIÇÃO MUNICIPAL';
3303
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3304
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3305
        //inscrição municipal
3306
        $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
3307
            $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : '';
3308
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
3309
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3310
        //VALOR TOTAL DOS SERVIÇOS
3311
        $x     += $w;
3312
        $texto = 'VALOR TOTAL DOS SERVIÇOS';
3313
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3314
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3315
        if (isset($this->ISSQNtot)) {
3316
            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
3317
                $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : '';
3318
            $texto = number_format($texto, 2, ",", ".");
3319
        } else {
3320
            $texto = '';
3321
        }
3322
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
3323
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3324
        //BASE DE CÁLCULO DO ISSQN
3325
        $x     += $w;
3326
        $texto = 'BASE DE CÁLCULO DO ISSQN';
3327
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3328
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3329
        if (isset($this->ISSQNtot)) {
3330
            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
3331
                $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : '';
3332
            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
3333
        } else {
3334
            $texto = '';
3335
        }
3336
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
3337
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3338
        //VALOR TOTAL DO ISSQN
3339
        $x += $w;
3340
        if ($this->orientacao == 'P') {
3341
            $w = $this->wPrint - (3 * $w);
3342
        } else {
3343
            $w = $this->wPrint - (3 * $w) - $this->wCanhoto;
3344
        }
3345
        $texto = 'VALOR TOTAL DO ISSQN';
3346
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3347
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3348
        if (isset($this->ISSQNtot)) {
3349
            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
3350
                $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : '';
3351
            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
3352
        } else {
3353
            $texto = '';
3354
        }
3355
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
3356
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3357
3358
        return ($y + $h + 1);
3359
    }
3360
3361
    /**
3362
     *dadosAdicionais
3363
     * Coloca o grupo de dados adicionais da NFe. (retrato e paisagem)
3364
     *
3365
     * @name   dadosAdicionais
3366
     *
3367
     * @param float $x Posição horizontal canto esquerdo
3368
     * @param float $y Posição vertical canto superior
3369
     * @param float $h altura do campo
3370
     *
3371
     * @return float Posição vertical final (eixo Y)
3372
     */
3373
    protected function dadosAdicionais($x, $y, $h)
0 ignored issues
show
Unused Code introduced by
The parameter $y is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
3374
    {
3375
        $y = $this->maxH - (7 + $h);
3376
        //$y = $this->maxH - 20;
3377
        //##################################################################################
3378
        //DADOS ADICIONAIS
3379
        $texto = "DADOS ADICIONAIS";
3380
        if ($this->orientacao == 'P') {
3381
            $w = $this->wPrint;
3382
        } else {
3383
            $w = $this->wPrint - $this->wCanhoto;
3384
        }
3385
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
3386
        $this->pdf->textBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3387
3388
        //INFORMAÇÕES COMPLEMENTARES
3389
        $texto = "INFORMAÇÕES COMPLEMENTARES";
3390
        $y     += 3;
3391
        $w     = $this->wAdic;
3392
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'B'];
3393
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3394
        //o texto com os dados adicionais foi obtido na função montaDANFE
3395
        //e carregado em uma propriedade privada da classe
3396
        $y     += 1;
3397
        $aFont = ['font' => $this->fontePadrao, 'size' => $this->textadicfontsize * $this->pdf->k, 'style' => ''];
3398
        //$aFont = ['font'=>$this->fontePadrao, 'size'=> 5, 'style'=>''];
3399
        $this->pdf->textBox($x, $y + 2, $w - 2, $h, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3400
        //RESERVADO AO FISCO
3401
        $texto = "RESERVADO AO FISCO";
3402
        if (isset($this->nfeProc) && $this->nfeProc->getElementsByTagName("xMsg")->length) {
3403
            $texto = $texto . ' ' . $this->nfeProc->getElementsByTagName("xMsg")->item(0)->nodeValue;
3404
        }
3405
        $x += $w;
3406
        $y -= 1;
3407
        if ($this->orientacao == 'P') {
3408
            $w = $this->wPrint - $w;
3409
        } else {
3410
            $w = $this->wPrint - $w - $this->wCanhoto;
3411
        }
3412
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'B'];
3413
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3414
        //inserir texto informando caso de contingência
3415
        // 1 - Normal - emissão normal;
3416
        // 2 - Contingência FS - emissão em contingência com impressão do DANFE em Formulário de Segurança;
3417
        // 3 - Contingência SCAN - emissão em contingência no Sistema de Contingência do Ambiente Nacional;
3418
        // 4 - Contingência EPEC - emissão em contingência com envio da Evento
3419
        //     Prévia de Emissão em Contingência;
3420
        // 5 - Contingência FS-DA - emissão em contingência com impressão do DANFE em Formulário de
3421
        //     Segurança para Impressão de Documento Auxiliar de Documento Fiscal Eletrônico (FS-DA);
3422
        // 6 - Contingência SVC-AN
3423
        // 7 - Contingência SVC-RS
3424
        $xJust  = $this->getTagValue($this->ide, 'xJust', 'Justificativa: ');
3425
        $dhCont = $this->getTagValue($this->ide, 'dhCont', ' Entrada em contingência : ');
3426
        $texto  = '';
3427
        switch ($this->tpEmis) {
3428
            case 4:
3429
                $texto = "CONTINGÊNCIA EPEC\n" . $dhCont . "\n" . $xJust;
3430
                break;
3431
            case 5:
3432
                $texto = "CONTINGÊNCIA FSDA\n" . $dhCont . "\n" . $xJust;
3433
                break;
3434
            case 6:
3435
                $texto = "CONTINGÊNCIA SVC-AN\n" . $dhCont . "\n" . $xJust;
3436
                break;
3437
            case 7:
3438
                $texto = "CONTINGÊNCIA SVC-RS\n" . $dhCont . "\n" . $xJust;
3439
                break;
3440
        }
3441
        $y     += 2;
3442
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
3443
        $this->pdf->textBox($x, $y, $w - 2, $h, $texto, $aFont, 'T', 'L', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3444
3445
        return $y + $h;
3446
    }
3447
3448
    /**
3449
     * rodape
3450
     * Monta o rodapé no final da DANFE com a data/hora de impressão e informações
3451
     * sobre a API NfePHP
3452
     *
3453
     * @param float $x Posição horizontal canto esquerdo
3454
     *
3455
     * @return void
3456
     */
3457
    protected function rodape($x)
3458
    {
3459
        $y = $this->maxH - 4;
3460
        if ($this->orientacao == 'P') {
3461
            $w = $this->wPrint;
3462
        } else {
3463
            $w = $this->wPrint - $this->wCanhoto;
3464
            $x = $this->wCanhoto;
3465
        }
3466
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I'];
3467
        $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s')
3468
            . '  ' . $this->creditos;
3469
        $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false);
3470
        $texto = $this->powered ? "Powered by NFePHP®" : '';
3471
        $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'R', false, '');
3472
    }
3473
3474
    /**
3475
     * Monta o canhoto da DANFE (retrato e paisagem)
3476
     *
3477
     * @name   canhotoDANFE
3478
     *
3479
     * @param number $x Posição horizontal canto esquerdo
3480
     * @param number $y Posição vertical canto superior
3481
     *
3482
     * @return number Posição vertical final
3483
     *
3484
     * TODO 21/07/14 fmertins: quando orientação L-paisagem, o canhoto está sendo gerado incorretamente
3485
     */
3486
    protected function canhoto($x, $y)
3487
    {
3488
        $oldX = $x;
3489
        $oldY = $y;
3490
        //#################################################################################
3491
        //canhoto
3492
        //identificação do tipo de nf entrada ou saida
3493
        $tpNF = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
3494
        if ($tpNF == '0') {
3495
            //NFe de Entrada
3496
            $emitente     = '';
3497
            $emitente     .= $this->dest->getElementsByTagName("xNome")->item(0)->nodeValue . " - ";
3498
            $emitente     .= $this->enderDest->getElementsByTagName("xLgr")->item(0)->nodeValue . ", ";
3499
            $emitente     .= $this->enderDest->getElementsByTagName("nro")->item(0)->nodeValue . " - ";
3500
            $emitente     .= $this->getTagValue($this->enderDest, "xCpl", " - ", " ");
3501
            $emitente     .= $this->enderDest->getElementsByTagName("xBairro")->item(0)->nodeValue . " ";
3502
            $emitente     .= $this->enderDest->getElementsByTagName("xMun")->item(0)->nodeValue . "-";
3503
            $emitente     .= $this->enderDest->getElementsByTagName("UF")->item(0)->nodeValue . "";
3504
            $destinatario = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue . " ";
3505
        } else {
3506
            //NFe de Saída
3507
            $emitente     = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue . " ";
3508
            $destinatario = '';
3509
            $destinatario .= $this->dest->getElementsByTagName("xNome")->item(0)->nodeValue . " - ";
3510
            $destinatario .= $this->enderDest->getElementsByTagName("xLgr")->item(0)->nodeValue . ", ";
3511
            $destinatario .= $this->enderDest->getElementsByTagName("nro")->item(0)->nodeValue . " ";
3512
            $destinatario .= $this->getTagValue($this->enderDest, "xCpl", " - ", " ");
3513
            $destinatario .= $this->enderDest->getElementsByTagName("xBairro")->item(0)->nodeValue . " ";
3514
            $destinatario .= $this->enderDest->getElementsByTagName("xMun")->item(0)->nodeValue . "-";
3515
            $destinatario .= $this->enderDest->getElementsByTagName("UF")->item(0)->nodeValue . " ";
3516
        }
3517
        //identificação do sistema emissor
3518
        //linha separadora do canhoto
3519
        if ($this->orientacao == 'P') {
3520
            $w = round($this->wPrint * 0.81, 0);
3521
        } else {
3522
            //linha separadora do canhoto - 238
3523
            //posicao altura
3524
            $y = $this->wPrint - 85;
3525
            //altura
3526
            $w = $this->wPrint - 85 - 24;
3527
        }
3528
        $h = 10;
3529
        //desenha caixa
3530
        $texto      = '';
3531
        $aFont      = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
3532
        $aFontSmall = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3533
        if ($this->orientacao == 'P') {
3534
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'L', 1, '', false);
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3535
        } else {
3536
            $this->pdf->textBox90($x, $y, $w, $h, $texto, $aFont, 'C', 'L', 1, '', false);
3537
        }
3538
        $numNF = str_pad($this->ide->getElementsByTagName('nNF')->item(0)->nodeValue, 9, "0", STR_PAD_LEFT);
3539
        $serie = str_pad($this->ide->getElementsByTagName('serie')->item(0)->nodeValue, 3, "0", STR_PAD_LEFT);
3540
        $texto = "RECEBEMOS DE ";
3541
        $texto .= $emitente;
3542
        $texto .= " OS PRODUTOS E/OU SERVIÇOS CONSTANTES DA NOTA FISCAL ELETRÔNICA INDICADA ";
3543
        if ($this->orientacao == 'P') {
3544
            $texto .= "ABAIXO";
3545
        } else {
3546
            $texto .= "AO LADO";
3547
        }
3548
        $texto .= ". EMISSÃO: ";
3549
        $dEmi  = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3550
            $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3551
        if ($dEmi == '') {
3552
            $dEmi  = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3553
                $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3554
            $aDemi = explode('T', $dEmi);
3555
            $dEmi  = $aDemi[0];
3556
        }
3557
        $texto .= $this->ymdTodmy($dEmi) . " ";
3558
        $texto .= "VALOR TOTAL: R$ ";
3559
        $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " ";
3560
        $texto .= "DESTINATÁRIO: ";
3561
        $texto .= $destinatario;
3562
        if ($this->orientacao == 'P') {
3563
            $this->pdf->textBox($x, $y, $w - 1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3564
            $x1    = $x + $w;
3565
            $w1    = $this->wPrint - $w;
3566
            $texto = "NF-e";
3567
            $aFont = ['font' => $this->fontePadrao, 'size' => 14, 'style' => 'B'];
3568
            $this->pdf->textBox($x1, $y, $w1, 18, $texto, $aFont, 'T', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3569
            $texto = "Nº. " . $this->formatField($numNF, "###.###.###") . " \n";
3570
            $texto .= "Série $serie";
3571
            $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
3572
            $this->pdf->textBox($x1, $y, $w1, 18, $texto, $aFont, 'C', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3573
            //DATA DE RECEBIMENTO
3574
            $texto = "DATA DE RECEBIMENTO";
3575
            $y     += $h;
3576
            $w2    = round($this->wPrint * 0.17, 0); //35;
3577
            $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3578
            $this->pdf->textBox($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3579
            //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3580
            $x     += $w2;
3581
            $w3    = $w - $w2;
3582
            $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3583
            $this->pdf->textBox($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3584
            $x = $oldX;
3585
            $y += 9;
3586
            $this->pdf->dashedHLine($x, $y, $this->wPrint, 0.1, 80);
3587
            $y += 2;
3588
3589
            return $y;
3590
        } else {
3591
            $x --;
3592
            $x = $this->pdf->textBox90($x, $y, $w - 1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
0 ignored issues
show
Unused Code introduced by
$x 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...
3593
            //NUMERO DA NOTA FISCAL LOGO NFE
3594
            $w1    = 18;
3595
            $x1    = $oldX;
3596
            $y     = $oldY;
3597
            $texto = "NF-e";
3598
            $aFont = ['font' => $this->fontePadrao, 'size' => 14, 'style' => 'B'];
3599
            $this->pdf->textBox($x1, $y, $w1, 18, $texto, $aFont, 'T', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3600
            $texto = "Nº.\n" . $this->formatField($numNF, "###.###.###") . " \n";
3601
            $texto .= "Série $serie";
3602
            $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
3603
            $this->pdf->textBox($x1, $y, $w1, 18, $texto, $aFont, 'C', 'C', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3604
            //DATA DO RECEBIMENTO
3605
            $texto = "DATA DO RECEBIMENTO";
3606
            $y     = $this->wPrint - 85;
3607
            $x     = 12;
3608
            $w2    = round($this->wPrint * 0.17, 0); //35;
3609
            $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3610
            $this->pdf->textBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3611
            //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3612
            $y     -= $w2;
3613
            $w3    = $w - $w2;
3614
            $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3615
            $aFont = ['font' => $this->fontePadrao, 'size' => 5.7, 'style' => ''];
3616
            $x     = $this->pdf->textBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3617
            $this->pdf->dashedVLine(22, $oldY, 0.1, $this->wPrint, 69);
3618
3619
            return $x;
3620
        }
3621
    }
3622
3623
    /**
3624
     * geraInformacoesDaTagCompra
3625
     * Devolve uma string contendo informação sobre as tag <compra><xNEmp>, <xPed> e <xCont> ou string vazia.
3626
     * Aviso: Esta função não leva em consideração dados na tag xPed do item.
3627
     *
3628
     * @name   pGeraInformacoesDaTagCompra
3629
     * @return string com as informacoes dos pedidos.
3630
     */
3631
    protected function geraInformacoesDaTagCompra()
3632
    {
3633
        if (! $this->gerarInformacoesAutomaticas) {
3634
            return '';
3635
        }
3636
        $saida = "";
3637
        if (isset($this->compra)) {
3638
            if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3639
                $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue;
3640
            }
3641
            if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3642
                $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue;
3643
            }
3644
            if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3645
                $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue;
3646
            }
3647
        }
3648
3649
        return $saida;
3650
    }
3651
3652
    /**
3653
     * geraChaveAdicionalDeContingencia
3654
     *
3655
     * @name   geraChaveAdicionalDeContingencia
3656
     * @return string chave
3657
     */
3658
    protected function geraChaveAdicionalDeContingencia()
3659
    {
3660
        //cUF tpEmis CNPJ vNF ICMSp ICMSs DD  DV
3661
        // Quantidade de caracteres  02   01      14  14    01    01  02 01
3662
        $forma = "%02d%d%s%014d%01d%01d%02d";
3663
        $cUF   = $this->ide->getElementsByTagName('cUF')->item(0)->nodeValue;
3664
        $CNPJ  = "00000000000000" . $this->emit->getElementsByTagName('CNPJ')->item(0)->nodeValue;
3665
        $CNPJ  = substr($CNPJ, - 14);
3666
        $vNF   = $this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue * 100;
3667
        $vICMS = $this->ICMSTot->getElementsByTagName("vICMS")->item(0)->nodeValue;
3668
        if ($vICMS > 0) {
3669
            $vICMS = 1;
3670
        }
3671
        $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3672
        if ($icmss > 0) {
3673
            $icmss = 1;
3674
        }
3675
        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3676
            $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3677
        if ($dEmi == '') {
3678
            $dEmi  = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3679
                $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3680
            $aDemi = explode('T', $dEmi);
3681
            $dEmi  = $aDemi[0];
3682
        }
3683
        $dd    = $dEmi;
3684
        $rpos  = strrpos($dd, '-');
3685
        $dd    = substr($dd, $rpos + 1);
3686
        $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd);
3687
        $chave = $chave . $this->modulo11($chave);
3688
3689
        return $chave;
3690
    }
3691
3692
    /**
3693
     *  geraInformacoesDasNotasReferenciadas
3694
     * Devolve uma string contendo informação sobre as notas referenciadas. Suporta N notas, eletrônicas ou não
3695
     * Exemplo: NFe Ref.: série: 01 número: 01 emit: 11.111.111/0001-01
3696
     * em 10/2010 [0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000]
3697
     *
3698
     * @return string Informacoes a serem adicionadas no rodapé sobre notas referenciadas.
3699
     */
3700
    protected function geraInformacoesDasNotasReferenciadas()
3701
    {
3702
        if (! $this->gerarInformacoesAutomaticas) {
3703
            return '';
3704
        }
3705
        $formaNfeRef = "\r\nNFe Ref.: série:%d número:%d emit:%s em %s [%s]";
3706
        $formaCTeRef = "\r\nCTe Ref.: série:%d número:%d emit:%s em %s [%s]";
3707
        $formaNfRef  = "\r\nNF  Ref.: série:%d numero:%d emit:%s em %s modelo: %d";
3708
        $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d";
3709
        $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s";
3710
        $saida       = '';
3711
        $nfRefs      = $this->ide->getElementsByTagName('NFref');
3712
        if (0 === $nfRefs->length) {
3713
            return $saida;
3714
        }
3715
        if ($nfRefs->length > 2) {
3716
            return 'Existem mais de 2 NF/NFe/ECF/NFP/CTe referenciadas, não serão exibidas na DANFE.';
3717
        }
3718
        foreach ($nfRefs as $nfRef) {
3719
            if (empty($nfRef)) {
3720
                continue;
3721
            }
3722
            $refNFe = $nfRef->getElementsByTagName('refNFe');
3723
            foreach ($refNFe as $chave_acessoRef) {
3724
                $chave_acesso  = $chave_acessoRef->nodeValue;
3725
                $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3726
                $data          = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3727
                $cnpj          = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3728
                $serie         = substr($chave_acesso, 22, 3);
3729
                $numero        = substr($chave_acesso, 25, 9);
3730
                $saida         .= sprintf($formaNfeRef, $serie, $numero, $cnpj, $data, $chave_acessoF);
3731
            }
3732
            $refNF = $nfRef->getElementsByTagName('refNF');
3733
            foreach ($refNF as $umaRefNFe) {
3734
                $data   = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3735
                $cnpj   = $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue;
3736
                $mod    = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3737
                $serie  = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
3738
                $numero = $umaRefNFe->getElementsByTagName('nNF')->item(0)->nodeValue;
3739
                $data   = substr($data, 2, 2) . "/20" . substr($data, 0, 2);
3740
                $cnpj   = $this->formatField($cnpj, "##.###.###/####-##");
3741
                $saida  .= sprintf($formaNfRef, $serie, $numero, $cnpj, $data, $mod);
3742
            }
3743
            $refCTe = $nfRef->getElementsByTagName('refCTe');
3744
            foreach ($refCTe as $chave_acessoRef) {
3745
                $chave_acesso  = $chave_acessoRef->nodeValue;
3746
                $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3747
                $data          = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3748
                $cnpj          = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3749
                $serie         = substr($chave_acesso, 22, 3);
3750
                $numero        = substr($chave_acesso, 25, 9);
3751
                $saida         .= sprintf($formaCTeRef, $serie, $numero, $cnpj, $data, $chave_acessoF);
3752
            }
3753
            $refECF = $nfRef->getElementsByTagName('refECF');
3754
            foreach ($refECF as $umaRefNFe) {
3755
                $mod   = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3756
                $nECF  = $umaRefNFe->getElementsByTagName('nECF')->item(0)->nodeValue;
3757
                $nCOO  = $umaRefNFe->getElementsByTagName('nCOO')->item(0)->nodeValue;
3758
                $saida .= sprintf($formaECFRef, $mod, $nECF, $nCOO);
3759
            }
3760
            $refNFP = $nfRef->getElementsByTagName('refNFP');
3761
            foreach ($refNFP as $umaRefNFe) {
3762
                $data   = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3763
                $cnpj   = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3764
                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue :
3765
                    '';
3766
                $cpf    = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3767
                    $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : '';
3768
                $mod    = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3769
                $serie  = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
3770
                $numero = $umaRefNFe->getElementsByTagName('nNF')->item(0)->nodeValue;
3771
                $ie     = $umaRefNFe->getElementsByTagName('IE')->item(0)->nodeValue;
3772
                $data   = substr($data, 2, 2) . "/20" . substr($data, 0, 2);
3773
                if ($cnpj == '') {
3774
                    $cpf_cnpj = $this->formatField($cpf, "###.###.###-##");
3775
                } else {
3776
                    $cpf_cnpj = $this->formatField($cnpj, "##.###.###/####-##");
3777
                }
3778
                $saida .= sprintf($formaNfpRef, $serie, $numero, $cpf_cnpj, $data, $mod, $ie);
3779
            }
3780
        }
3781
3782
        return $saida;
3783
    }
3784
3785
    private function loadDoc($xml)
3786
    {
3787
        $this->xml = $xml;
3788
        if (! empty($xml)) {
3789
            $this->dom = new Dom();
3790
            $this->dom->loadXML($this->xml);
3791
            if (empty($this->dom->getElementsByTagName("infNFe")->item(0))) {
3792
                throw new \Exception('Isso não é um NFe.');
3793
            }
3794
            $this->nfeProc = $this->dom->getElementsByTagName("nfeProc")->item(0);
3795
            $this->infNFe  = $this->dom->getElementsByTagName("infNFe")->item(0);
3796
            $this->ide     = $this->dom->getElementsByTagName("ide")->item(0);
3797
            if ($this->getTagValue($this->ide, "mod") != '55') {
3798
                throw new \Exception("O xml deve ser NF-e modelo 55.");
3799
            }
3800
            $this->entrega    = $this->dom->getElementsByTagName("entrega")->item(0);
3801
            $this->retirada   = $this->dom->getElementsByTagName("retirada")->item(0);
3802
            $this->emit       = $this->dom->getElementsByTagName("emit")->item(0);
3803
            $this->dest       = $this->dom->getElementsByTagName("dest")->item(0);
3804
            $this->enderEmit  = $this->dom->getElementsByTagName("enderEmit")->item(0);
3805
            $this->enderDest  = $this->dom->getElementsByTagName("enderDest")->item(0);
3806
            $this->det        = $this->dom->getElementsByTagName("det");
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->dom->getElementsByTagName('det') of type object<DOMNodeList> is incompatible with the declared type object<DOMNode> of property $det.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
3807
            $this->cobr       = $this->dom->getElementsByTagName("cobr")->item(0);
3808
            $this->dup        = $this->dom->getElementsByTagName('dup');
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->dom->getElementsByTagName('dup') of type object<DOMNodeList> is incompatible with the declared type object<DOMNode> of property $dup.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
3809
            $this->ICMSTot    = $this->dom->getElementsByTagName("ICMSTot")->item(0);
3810
            $this->ISSQNtot   = $this->dom->getElementsByTagName("ISSQNtot")->item(0);
3811
            $this->transp     = $this->dom->getElementsByTagName("transp")->item(0);
3812
            $this->transporta = $this->dom->getElementsByTagName("transporta")->item(0);
3813
            $this->veicTransp = $this->dom->getElementsByTagName("veicTransp")->item(0);
3814
            $this->detPag     = $this->dom->getElementsByTagName("detPag");
3815
            $this->reboque    = $this->dom->getElementsByTagName("reboque")->item(0);
3816
            $this->infAdic    = $this->dom->getElementsByTagName("infAdic")->item(0);
3817
            $this->compra     = $this->dom->getElementsByTagName("compra")->item(0);
3818
            $this->tpEmis     = $this->getTagValue($this->ide, "tpEmis");
0 ignored issues
show
Documentation Bug introduced by
The property $tpEmis was declared of type integer, but $this->getTagValue($this->ide, 'tpEmis') is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
3819
            $this->tpImp      = $this->getTagValue($this->ide, "tpImp");
0 ignored issues
show
Documentation Bug introduced by
The property $tpImp was declared of type integer, but $this->getTagValue($this->ide, 'tpImp') is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
3820
            $this->infProt    = $this->dom->getElementsByTagName("infProt")->item(0);
3821
        }
3822
    }
3823
3824
    /**
3825
     * @param $item
3826
     *
3827
     * @return float
3828
     */
3829
    protected function calculeHeight($item, $mostrarUnidadeTributavel = false)
3830
    {
3831
        if ($this->orientacao == 'P') {
3832
            $w = $this->wPrint;
3833
        } else {
3834
            $w = $this->wPrint - $this->wCanhoto;
3835
        }
3836
        $w2           = round($w * 0.25, 0);
3837
        $aFont        = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
3838
        $textoProduto = $this->descricaoProduto($item);
3839
        $numlinhas    = $this->pdf->getNumLines($textoProduto, $w2, $aFont);
3840
3841
        if ($mostrarUnidadeTributavel && $numlinhas == 1) {
3842
            $numlinhas ++;
3843
        }
3844
3845
        return round(($numlinhas * $this->pdf->fontSize) + ($numlinhas * 0.5), 2);
3846
    }
3847
}
3848