Completed
Push — master ( d1009b...cf74c6 )
by Roberto
06:51 queued 03:26
created

Danfe::sizeExtraTextoFatura()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
cc 3
nc 2
nop 0
dl 0
loc 10
ccs 0
cts 8
cp 0
crap 12
rs 9.9332
c 0
b 0
f 0
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
     * XML NFe
69
     *
70
     * @var string
71
     */
72
    protected $xml;
73
    /**
74
     * mesagens de erro
75
     *
76
     * @var string
77
     */
78
    protected $errMsg = '';
79
    /**
80
     * status de erro true um erro ocorreu false sem erros
81
     *
82
     * @var boolean
83
     */
84
    protected $errStatus = false;
85
    /**
86
     * Texto adicional da DANFE
87
     *
88
     * @var string
89
     */
90
    protected $textoAdic = '';
91
    /**
92
     * Largura
93
     *
94
     * @var float
95
     */
96
    protected $wAdic = 0;
97
    /**
98
     * largura do canhoto (25mm) apenas para a formatação paisagem
99
     *
100
     * @var float
101
     */
102
    protected $wCanhoto = 25;
103
    /**
104
     * Formato chave
105
     *
106
     * @var string
107
     */
108
    protected $formatoChave = "#### #### #### #### #### #### #### #### #### #### ####";
109
    /**
110
     * quantidade de itens já processados na montagem do DANFE
111
     *
112
     * @var integer
113
     */
114
    protected $qtdeItensProc;
115
    /**
116
     * Dom Document
117
     *
118
     * @var \NFePHP\DA\Legacy\Dom
119
     */
120
    protected $dom;
121
    /**
122
     * Node
123
     *
124
     * @var \DOMNode
125
     */
126
    protected $infNFe;
127
    /**
128
     * Node
129
     *
130
     * @var \DOMNode
131
     */
132
    protected $ide;
133
    /**
134
     * Node
135
     *
136
     * @var \DOMNode
137
     */
138
    protected $entrega;
139
    /**
140
     * Node
141
     *
142
     * @var \DOMNode
143
     */
144
    protected $retirada;
145
    /**
146
     * Node
147
     *
148
     * @var \DOMNode
149
     */
150
    protected $emit;
151
    /**
152
     * Node
153
     *
154
     * @var \DOMNode
155
     */
156
    protected $dest;
157
    /**
158
     * Node
159
     *
160
     * @var \DOMNode
161
     */
162
    protected $enderEmit;
163
    /**
164
     * Node
165
     *
166
     * @var \DOMNode
167
     */
168
    protected $enderDest;
169
    /**
170
     * Node
171
     *
172
     * @var \DOMNode
173
     */
174
    protected $det;
175
    /**
176
     * Node
177
     *
178
     * @var \DOMNode
179
     */
180
    protected $cobr;
181
    /**
182
     * Node
183
     *
184
     * @var \DOMNode
185
     */
186
    protected $dup;
187
    /**
188
     * Node
189
     *
190
     * @var \DOMNode
191
     */
192
    protected $ICMSTot;
193
    /**
194
     * Node
195
     *
196
     * @var \DOMNode
197
     */
198
    protected $ISSQNtot;
199
    /**
200
     * Node
201
     *
202
     * @var \DOMNode
203
     */
204
    protected $transp;
205
    /**
206
     * Node
207
     *
208
     * @var \DOMNode
209
     */
210
    protected $transporta;
211
    /**
212
     * Node
213
     *
214
     * @var \DOMNode
215
     */
216
    protected $veicTransp;
217
    /**
218
     * Node reboque
219
     *
220
     * @var \DOMNode
221
     */
222
    protected $reboque;
223
    /**
224
     * Node infAdic
225
     *
226
     * @var \DOMNode
227
     */
228
    protected $infAdic;
229
    /**
230
     * Tipo de emissão
231
     *
232
     * @var integer
233
     */
234
    protected $tpEmis;
235
    /**
236
     * Node infProt
237
     *
238
     * @var \DOMNode
239
     */
240
    protected $infProt;
241
    /**
242
     * 1-Retrato/ 2-Paisagem
243
     *
244
     * @var integer
245
     */
246
    protected $tpImp;
247
    /**
248
     * Node compra
249
     *
250
     * @var \DOMNode
251
     */
252
    protected $compra;
253
    /**
254
     * @var int
255
     */
256
    protected $textadicfontsize;
257
    /**
258
     * Número de casas para a quantidade de itens da unidade comercial.
259
     *
260
     * @var integer
261
     */
262
    protected $qComCasasDec = 4;
263
264
    /**
265
     * Número de casas decimais para o valor da unidade comercial.
266
     *
267
     * @var integer
268
     */
269
    protected $vUnComCasasDec = 4;
270
271
    /**
272
     * @var int
273
     */
274
    protected $hdadosadic = 10;
275
    /**
276
     *
277
     * @var array
278
     */
279
    protected $epec = [];
280
281
    /**
282
     * __construct
283
     *
284
     * @name  __construct
285
     *
286
     * @param string $xml Conteúdo XML da NF-e (com ou sem a tag nfeProc)
287
     */
288
    public function __construct($xml)
289
    {
290
        $this->loadDoc($xml);
291
    }
292
    
293
    public function epec($protocolo, $data)
294
    {
295
        if ($this->dom->getElementsByTagName("tpEmis")->item(0)->nodeValue != '4') {
296
            throw new \Exception('Esta nota não foi emitida em contingência EPEC, tpEmis != 4.');
297
        }
298
        $this->epec = [
299
            'protocolo' => $protocolo,
300
            'data' => $data
301
        ];
302
    }
303
304
305
    /**
306
     * Define a quantidade de casas decimais para unidade comercial.
307
     *
308
     * @param integer $vUnComCasasDec
309
     */
310
    public function setVUnComCasasDec($vUnComCasasDec)
311
    {
312
        $this->vUnComCasasDec = $vUnComCasasDec;
313
    }
314
315
    /**
316
     * Define a quantidade de casas decimais para unidade comercial.
317
     *
318
     * @param integer $qComCasasDec
319
     */
320
    public function setQComCasasDec($qComCasasDec)
321
    {
322
        $this->qComCasasDec = $qComCasasDec;
323
    }
324
325
    protected function calculoEspacoVericalDadosAdicionais()
326
    {
327
        $this->textoAdic = '';
328
        //informações adicionais
329
        $fontProduto            = [
330
            'font'  => $this->fontePadrao,
331
            'size'  => 8,
332
            'style' => ''
333
        ];
334
        $k                      = $this->pdf->k;
335
        $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...
336
        $this->textoAdic        .= $this->geraInformacoesDasNotasReferenciadas();
337
        if (isset($this->infAdic)) {
338
            $i = 0;
339
            if ($this->textoAdic != '') {
340
                $this->textoAdic .= ". \n";
341
            }
342
            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infCpl"))
343
                ? 'Inf. Contribuinte: ' . $this->anfaveaDANFE($this->getTagValue($this->infAdic, "infCpl"))
344
                : '';
345
            $infPedido       = $this->geraInformacoesDaTagCompra();
346
            if ($infPedido != "") {
347
                $this->textoAdic .= $infPedido;
348
            }
349
            $this->textoAdic .= $this->getTagValue($this->dest, "email", ' Email do Destinatário: ');
350
            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infAdFisco"))
351
                ? "\n Inf. fisco: " . $this->getTagValue($this->infAdic, "infAdFisco")
352
                : '';
353
            $obsCont         = $this->infAdic->getElementsByTagName("obsCont");
354
            if (isset($obsCont)) {
355
                foreach ($obsCont as $obs) {
356
                    $campo           = $obsCont->item($i)->getAttribute("xCampo");
357
                    $xTexto          = ! empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue)
358
                        ? $obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue
359
                        : '';
360
                    $this->textoAdic .= "\n" . $campo . ':  ' . trim($xTexto);
361
                    $i ++;
362
                }
363
            }
364
        }
365
        //INCLUSO pela NT 2013.003 Lei da Transparência
366
        //verificar se a informação sobre o valor aproximado dos tributos
367
        //já se encontra no campo de informações adicionais
368
        if ($this->exibirValorTributos) {
369
            $flagVTT  = strpos(strtolower(trim($this->textoAdic)), 'valor');
370
            $flagVTT  = $flagVTT || strpos(strtolower(trim($this->textoAdic)), 'vl');
371
            $flagVTT  = $flagVTT && strpos(strtolower(trim($this->textoAdic)), 'aprox');
372
            $flagVTT  = $flagVTT && (strpos(strtolower(trim($this->textoAdic)), 'trib') ||
373
                    strpos(strtolower(trim($this->textoAdic)), 'imp'));
374
            $vTotTrib = $this->getTagValue($this->ICMSTot, 'vTotTrib');
375
            if ($vTotTrib != '' && ! $flagVTT) {
376
                $this->textoAdic .= "\n Valor Aproximado dos Tributos : R$ "
377
                    . number_format($vTotTrib, 2, ",", ".");
378
            }
379
        }
380
        //fim da alteração NT 2013.003 Lei da Transparência
381
        $this->textoAdic        = str_replace(";", "\n", $this->textoAdic);
382
        $numlinhasdados         = $this->pdf->getNumLines($this->textoAdic, $this->wAdic, $fontProduto) + 1.5;
383
        $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...
384
        $hdadosadic             = ceil($numlinhasdados * ($this->textadicfontsize));
385
        if ($hdadosadic > 70) {
386
            for ($f = 8; $f > 3; $f --) {
387
                $this->pdf->setFont($this->fontePadrao, '', $f);
388
                $fontProduto            = [
389
                    'font'  => $this->fontePadrao,
390
                    'size'  => $f,
391
                    'style' => ''
392
                ];
393
                $numlinhasdados         = $this->pdf->getNumLines($this->textoAdic, $this->wAdic, $fontProduto) + 3;
394
                $this->textadicfontsize = $this->pdf->fontSize;
395
                $hdadosadic             = ceil($numlinhasdados * $this->textadicfontsize);
396
                echo $hdadosadic;
397
                if ($hdadosadic <= 90) {
398
                    $hdadosadic = ceil($hdadosadic);
399
                    break;
400
                }
401
            }
402
        }
403
        if ($hdadosadic < 10) {
404
            $hdadosadic = 10;
405
        }
406
407
        return $hdadosadic;
408
    }
409
410
    /**
411
     * monta
412
     * Monta a DANFE conforme as informações fornecidas para a classe durante sua
413
     * construção. Constroi DANFEs com até 3 páginas podendo conter até 56 itens.
414
     * A definição de margens e posições iniciais para a impressão são estabelecidas
415
     * pelo conteúdo da funçao e podem ser modificados.
416
     *
417
     * @return string O ID da NFe numero de 44 digitos extraido do arquivo XML
418
     */
419
    protected function monta(
420
        $logo = ''
421
    ) {
422
        $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...
423
        $this->logomarca = $this->adjustImage($logo);
424
        //se a orientação estiver em branco utilizar o padrão estabelecido na NF
425
        if (empty($this->orientacao)) {
426
            if ($this->tpImp == '2') {
427
                $this->orientacao = 'L';
428
            } else {
429
                $this->orientacao = 'P';
430
            }
431
        }
432
        //instancia a classe pdf
433
        $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...
434
        //margens do PDF, em milímetros. Obs.: a margem direita é sempre igual à
435
        //margem esquerda. A margem inferior *não* existe na FPDF, é definida aqui
436
        //apenas para controle se necessário ser maior do que a margem superior
437
        // posição inicial do conteúdo, a partir do canto superior esquerdo da página
438
        $xInic = $this->margesq;
439
        if ($this->orientacao == 'P') {
440
            if ($this->papel == 'A4') {
441
                $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...
442
                $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...
443
            }
444
        } else {
445
            if ($this->papel == 'A4') {
446
                $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...
447
                $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...
448
                $xInic      = $this->margesq + 10;
449
                //se paisagem multiplica a largura do canhoto pela quantidade de canhotos
450
                //$this->wCanhoto *= $this->qCanhoto;
451
            }
452
        }
453
        //total inicial de paginas
454
        $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...
455
        //largura imprimivel em mm: largura da folha menos as margens esq/direita
456
        $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...
457
        //comprimento (altura) imprimivel em mm: altura da folha menos as margens
458
        //superior e inferior
459
        $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...
460
        // estabelece contagem de paginas
461
        $this->pdf->aliasNbPages();
462
        // fixa as margens
463
        $this->pdf->setMargins($this->margesq, $this->margsup);
464
        $this->pdf->setDrawColor(0, 0, 0);
465
        $this->pdf->setFillColor(255, 255, 255);
466
        // inicia o documento
467
        $this->pdf->open();
468
        // adiciona a primeira página
469
        $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...
470
        $this->pdf->setLineWidth(0.1);
471
        $this->pdf->settextcolor(0, 0, 0);
472
473
        //##################################################################
474
        // CALCULO DO NUMERO DE PAGINAS A SEREM IMPRESSAS
475
        //##################################################################
476
        //Verificando quantas linhas serão usadas para impressão das duplicatas
477
        $linhasDup = 0;
478
        $qtdPag    = 0;
479
        if (isset($this->dup) && $this->dup->length > 0) {
480
            $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...
481
        } 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...
482
            $qtdPag = $this->detPag->length;
483
        }
484
        if (($qtdPag > 0) && ($qtdPag <= 7)) {
485
            $linhasDup = 1;
486
        } elseif (($qtdPag > 7) && ($qtdPag <= 14)) {
487
            $linhasDup = 2;
488
        } elseif (($qtdPag > 14) && ($qtdPag <= 21)) {
489
            $linhasDup = 3;
490
        } elseif ($qtdPag > 21) {
491
            // chinnonsantos 11/05/2016: Limite máximo de impressão de duplicatas na NFe,
492
            // só vai ser exibito as 21 primeiras duplicatas (parcelas de pagamento),
493
            // se não oculpa espaço d+, cada linha comporta até 7 duplicatas.
494
            $linhasDup = 3;
495
        }
496
        //verifica se será impressa a linha dos serviços ISSQN
497
        $linhaISSQN = 0;
498
        if ((isset($this->ISSQNtot)) && ($this->getTagValue($this->ISSQNtot, 'vServ') > 0)) {
499
            $linhaISSQN = 1;
500
        }
501
        //calcular a altura necessária para os dados adicionais
502
        if ($this->orientacao == 'P') {
503
            $this->wAdic = round($this->wPrint * 0.66, 0);
504
        } else {
505
            $this->wAdic = round(($this->wPrint - $this->wCanhoto) * 0.5, 0);
506
        }
507
        $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...
508
509
        $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...
510
511
        //altura disponivel para os campos da DANFE
512
        $hcabecalho    = 47;//para cabeçalho
513
        $hdestinatario = 25;//para destinatario
514
        $hduplicatas   = 12;//para cada grupo de 7 duplicatas
515
        if (isset($this->entrega)) {
516
            $hlocalentrega = 25;
517
        } else {
518
            $hlocalentrega = 0;
519
        }
520
        if (isset($this->retirada)) {
521
            $hlocalretirada = 25;
522
        } else {
523
            $hlocalretirada = 0;
524
        }
525
        $himposto    = 18;// para imposto
526
        $htransporte = 25;// para transporte
527
        $hissqn      = 11;// para issqn
528
        $hfooter     = 5;// para rodape
529
        $hCabecItens = 4;//cabeçalho dos itens
530
        $hOCUPADA    = $hcabecalho
531
            + $hdestinatario
532
            + $hlocalentrega
533
            + $hlocalretirada
534
            + ($linhasDup * $hduplicatas)
535
            + $himposto + $htransporte
536
            + ($linhaISSQN * $hissqn)
537
            + $this->hdadosadic
538
            + $hfooter
539
            + $hCabecItens
540
            + $this->sizeExtraTextoFatura();
541
542
        //alturas disponiveis para os dados
543
        $hDispo1 = $this->hPrint - $hOCUPADA;
544
        /*($hcabecalho +
545
        //$hdestinatario + ($linhasDup * $hduplicatas) + $himposto + $htransporte +
546
        $hdestinatario + $hlocalentrega + $hlocalretirada +
547
        ($linhasDup * $hduplicatas) + $himposto + $htransporte +
548
        ($linhaISSQN * $hissqn) + $this->hdadosadic + $hfooter + $hCabecItens +
549
        $this->sizeExtraTextoFatura());*/
550
551
        if ($this->orientacao == 'P') {
552
            $hDispo1 -= 24 * $this->qCanhoto;//para canhoto
553
            $w       = $this->wPrint;
554
        } else {
555
            $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...
556
            $w        = $this->wPrint - $this->wCanhoto;
557
        }
558
        //$hDispo1 += 14;
559
        $hDispo2 = $this->hPrint - ($hcabecalho + $hfooter + $hCabecItens);
560
        //Contagem da altura ocupada para impressão dos itens
561
        $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...
562
        $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...
563
        $hUsado    = $hCabecItens;
564
        $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...
565
        $hDispo    = $hDispo1;
566
        $totPag    = 1;
567
        $i         = 0;
568
        while ($i < $this->det->length) {
569
            $itemProd = $this->det->item($i);
570
            $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...
571
            $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...
572
573
            $prod = $itemProd->getElementsByTagName('prod')->item(0);
574
            $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...
575
            $vUnCom = $prod->getElementsByTagName("vUnCom")->item(0)->nodeValue;
576
            $uTrib = $prod->getElementsByTagName("uTrib")->item(0);
577
            $qTrib = $prod->getElementsByTagName("qTrib")->item(0);
578
            $vUnTrib = !empty($prod->getElementsByTagName("vUnTrib")->item(0)->nodeValue)
579
                ? $prod->getElementsByTagName("vUnTrib")->item(0)->nodeValue
580
                : 0;
581
            //se as unidades forem diferentes e q qtda de qTrib for maior que 0
582
            //mostrat as unidades
583
            $mostrarUnidadeTributavel = (
584
                !empty($uTrib)
585
                && !empty($qTrib)
586
                && number_format($vUnCom, 2, ',', '') !== number_format($vUnTrib, 2, ',', '')
587
            );
588
            $hUsado += $this->calculeHeight($itemProd, $mostrarUnidadeTributavel);
589
            if ($hUsado > $hDispo) {
590
                $totPag ++;
591
                $hDispo = $hDispo2;
592
                $hUsado = $hCabecItens;
593
                $i --; // decrementa para readicionar o item que não coube nessa pagina na outra.
594
            }
595
            $i ++;
596
        } //fim da soma das areas de itens usadas
597
        $qtdeItens = $i; //controle da quantidade de itens no DANFE
598
        //montagem da primeira página
599
        $pag = 1;
600
601
        $x = $this->margesq;
602
        $y = $this->margsup;
603
        //coloca o(s) canhoto(s) da NFe
604
        if ($this->orientacao == 'P') {
605
            $y = $this->canhoto($this->margesq, $this->margsup);
606
        } else {
607
            $this->canhoto($this->margesq, $this->margsup);
608
            $x = 25;
609
        }
610
        //coloca o cabeçalho
611
        $y = $this->header($x, $y, $pag, $totPag);
612
        //coloca os dados do destinatário
613
        $y = $this->destinatarioDANFE($x, $y + 1);
614
        //coloca os dados do local de retirada
615
        if (isset($this->retirada)) {
616
            $y = $this->localRetiradaDANFE($x, $y + 1);
617
        }
618
        //coloca os dados do local de entrega
619
        if (isset($this->entrega)) {
620
            $y = $this->localEntregaDANFE($x, $y + 1);
621
        }
622
623
        //Verifica as formas de pagamento da nota fiscal
624
        $formaPag = [];
625
        if (isset($this->detPag) && $this->detPag->length > 0) {
626
            foreach ($this->detPag as $k => $d) {
627
                $fPag            = ! empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
628
                    ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue
629
                    : '0';
630
                $formaPag[$fPag] = $fPag;
631
            }
632
        }
633
        //caso tenha boleto imprimir fatura
634
        if ($this->dup->length > 0) {
635
            $y = $this->fatura($x, $y + 1);
636
        } else {
637
            //Se somente tiver a forma de pagamento sem pagamento não imprimir nada
638
            if (count($formaPag) == '1' && isset($formaPag[90])) {
639
                $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...
640
            } else {
641
                //caso tenha mais de uma forma de pagamento ou seja diferente de boleto exibe a
642
                //forma de pagamento e o valor
643
                $y = $this->pagamento($x, $y + 1);
644
            }
645
        }
646
        //coloca os dados dos impostos e totais da NFe
647
        $y = $this->imposto($x, $y + 1);
648
        //coloca os dados do trasnporte
649
        $y = $this->transporte($x, $y + 1);
650
        //itens da DANFE
651
        $nInicial = 0;
652
653
        $y = $this->itens($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
654
655
        //coloca os dados do ISSQN
656
        if ($linhaISSQN == 1) {
657
            $y = $this->issqn($x, $y + 4);
658
        } else {
659
            $y += 4;
660
        }
661
        //coloca os dados adicionais da NFe
662
        $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...
663
        //coloca o rodapé da página
664
        if ($this->orientacao == 'P') {
665
            $this->rodape($xInic);
666
        } else {
667
            $this->rodape($xInic);
668
        }
669
670
        //loop para páginas seguintes
671
        for ($n = 2; $n <= $totPag; $n ++) {
672
            // fixa as margens
673
            $this->pdf->setMargins($this->margesq, $this->margsup);
674
            //adiciona nova página
675
            $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...
676
            //ajusta espessura das linhas
677
            $this->pdf->setLineWidth(0.1);
678
            //seta a cor do texto para petro
679
            $this->pdf->settextcolor(0, 0, 0);
680
            // posição inicial do relatorio
681
            $x = $this->margesq;
682
            $y = $this->margsup;
683
            //coloca o cabeçalho na página adicional
684
            $y = $this->header($x, $y, $n, $totPag);
685
            //coloca os itens na página adicional
686
            $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...
687
            //coloca o rodapé da página
688
            if ($this->orientacao == 'P') {
689
                $this->rodape($this->margesq);
690
            } else {
691
                $this->rodape($this->margesq);
692
            }
693
            //se estiver na última página e ainda restar itens para inserir, adiciona mais uma página
694
            if ($n == $totPag && $this->qtdeItensProc < $qtdeItens) {
695
                $totPag ++;
696
            }
697
        }
698
    }
699
700
    /**
701
     * anfavea
702
     * Função para transformar o campo cdata do padrão ANFAVEA para
703
     * texto imprimível
704
     *
705
     * @param string $cdata campo CDATA
706
     *
707
     * @return string conteúdo do campo CDATA como string
708
     */
709
    protected function anfaveaDANFE($cdata = '')
710
    {
711
        if ($cdata == '') {
712
            return '';
713
        }
714
        //remove qualquer texto antes ou depois da tag CDATA
715
        $cdata    = str_replace('<![CDATA[', '<CDATA>', $cdata);
716
        $cdata    = str_replace(']]>', '</CDATA>', $cdata);
717
        $cdata    = preg_replace('/\s\s+/', ' ', $cdata);
718
        $cdata    = str_replace("> <", "><", $cdata);
719
        $len      = strlen($cdata);
720
        $startPos = strpos($cdata, '<');
721
        if ($startPos === false) {
722
            return $cdata;
723
        }
724
        for ($x = $len; $x > 0; $x --) {
725
            if (substr($cdata, $x, 1) == '>') {
726
                $endPos = $x;
727
                break;
728
            }
729
        }
730
        if ($x === 0) {
731
            return $cdata;
732
        }
733
        if ($startPos > 0) {
734
            $parte1 = substr($cdata, 0, $startPos);
735
        } else {
736
            $parte1 = '';
737
        }
738
        $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...
739
        if ($endPos < $len) {
740
            $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
741
        } else {
742
            $parte3 = '';
743
        }
744
        $texto = trim($parte1) . ' ' . trim($parte3);
745
        if (strpos($parte2, '<CDATA>') === false) {
746
            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
747
        } else {
748
            $cdata = $parte2;
749
        }
750
        //Retira a tag <FONTE IBPT> (caso existir) pois não é uma estrutura válida XML
751
        $cdata = str_replace('<FONTE IBPT>', '', $cdata);
752
        //carrega o xml CDATA em um objeto DOM
753
        $dom = new Dom();
754
        $dom->loadXML($cdata, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG);
755
        //$xml = $dom->saveXML();
756
        //grupo CDATA infADprod
757
        $id   = $dom->getElementsByTagName('id')->item(0);
758
        $div  = $dom->getElementsByTagName('div')->item(0);
759
        $entg = $dom->getElementsByTagName('entg')->item(0);
760
        $dest = $dom->getElementsByTagName('dest')->item(0);
761
        $ctl  = $dom->getElementsByTagName('ctl')->item(0);
762
        $ref  = $dom->getElementsByTagName('ref')->item(0);
763
        if (isset($id)) {
764
            if ($id->hasAttributes()) {
765
                foreach ($id->attributes as $attr) {
766
                    $name  = $attr->nodeName;
767
                    $value = $attr->nodeValue;
768
                    $texto .= " $name : $value";
769
                }
770
            }
771
        }
772
        if (isset($div)) {
773
            if ($div->hasAttributes()) {
774
                foreach ($div->attributes as $attr) {
775
                    $name  = $attr->nodeName;
776
                    $value = $attr->nodeValue;
777
                    $texto .= " $name : $value";
778
                }
779
            }
780
        }
781
        if (isset($entg)) {
782
            if ($entg->hasAttributes()) {
783
                foreach ($entg->attributes as $attr) {
784
                    $name  = $attr->nodeName;
785
                    $value = $attr->nodeValue;
786
                    $texto .= " $name : $value";
787
                }
788
            }
789
        }
790
        if (isset($dest)) {
791
            if ($dest->hasAttributes()) {
792
                foreach ($dest->attributes as $attr) {
793
                    $name  = $attr->nodeName;
794
                    $value = $attr->nodeValue;
795
                    $texto .= " $name : $value";
796
                }
797
            }
798
        }
799
        if (isset($ctl)) {
800
            if ($ctl->hasAttributes()) {
801
                foreach ($ctl->attributes as $attr) {
802
                    $name  = $attr->nodeName;
803
                    $value = $attr->nodeValue;
804
                    $texto .= " $name : $value";
805
                }
806
            }
807
        }
808
        if (isset($ref)) {
809
            if ($ref->hasAttributes()) {
810
                foreach ($ref->attributes as $attr) {
811
                    $name  = $attr->nodeName;
812
                    $value = $attr->nodeValue;
813
                    $texto .= " $name : $value";
814
                }
815
            }
816
        }
817
        //grupo CADATA infCpl
818
        $t          = $dom->getElementsByTagName('transmissor')->item(0);
819
        $r          = $dom->getElementsByTagName('receptor')->item(0);
820
        $versao     = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
821
            'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
822
        $especieNF  = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
823
            'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
824
        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
825
            'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
826
        $dca        = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
827
            'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
828
        $texto      .= "" . $versao . $especieNF . $fabEntrega . $dca;
829
        if (isset($t)) {
830
            if ($t->hasAttributes()) {
831
                $texto .= " Transmissor ";
832
                foreach ($t->attributes as $attr) {
833
                    $name  = $attr->nodeName;
834
                    $value = $attr->nodeValue;
835
                    $texto .= " $name : $value";
836
                }
837
            }
838
        }
839
        if (isset($r)) {
840
            if ($r->hasAttributes()) {
841
                $texto .= " Receptor ";
842
                foreach ($r->attributes as $attr) {
843
                    $name  = $attr->nodeName;
844
                    $value = $attr->nodeValue;
845
                    $texto .= " $name : $value";
846
                }
847
            }
848
        }
849
850
        return $texto;
851
    }
852
853
    /**
854
     * Verifica o status da NFe
855
     *
856
     * @return array
857
     */
858
    protected function statusNFe()
859
    {
860
        $resp = [
861
            'status' => true,
862
            'message' => [],
863
            'submessage' => ''
864
        ];
865
        if (!empty($this->epec)) {
866
            return $resp;
867
        }
868
        if (!isset($this->nfeProc)) {
869
            $resp['status'] = false;
870
            $resp['message'][] = 'NFe NÃO PROTOCOLADA';
871
        } else {
872
            if ($this->getTagValue($this->ide, "tpAmb") == '2') {
873
                $resp['status'] = false;
874
                $resp['message'][] =  "NFe EMITIDA EM HOMOLOGAÇÃO";
875
            }
876
            $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...
877
            $cStat = $this->getTagValue($this->nfeProc, "cStat");
878
            if ($cStat == '110' ||
879
                $cStat == '301' ||
880
                $cStat == '302'
881
            ) {
882
                $resp['status'] = false;
883
                $resp['message'][] = "NFe DENEGADA";
884
            } elseif ($cStat == '101'
885
                || $cStat == '151'
886
                || $cStat == '135'
887
                || $cStat == '155'
888
                || $this->cancelFlag === true
889
            ) {
890
                $resp['status'] = false;
891
                $resp['message'][] = "NFe CANCELADA";
892
            } elseif (!empty($retEvento)) {
893
                $infEvento = $retEvento->getElementsByTagName('infEvento')->item(0);
894
                $cStat = $this->getTagValue($infEvento, "cStat");
895
                $tpEvento= $this->getTagValue($infEvento, "tpEvento");
896
                $dhEvento = date("d/m/Y H:i:s", $this->toTimestamp($this->getTagValue($infEvento, "dhRegEvento")));
897
                $nProt = $this->getTagValue($infEvento, "nProt");
898
                if ($tpEvento == '110111' &&
899
                    ($cStat == '101' ||
900
                     $cStat == '151' ||
901
                     $cStat == '135' ||
902
                     $cStat == '155')
903
                ) {
904
                    $resp['status'] = false;
905
                    $resp['message'][] = "NFe CANCELADA";
906
                    $resp['submessage'] = "{$dhEvento} - {$nProt}";
907
                }
908
            }
909
        }
910
        return $resp;
911
    }
912
913
    /**
914
     *header
915
     * Monta o cabelhalho da DANFE (retrato e paisagem)
916
     *
917
     * @param number $x      Posição horizontal inicial, canto esquerdo
918
     * @param number $y      Posição vertical inicial, canto superior
919
     * @param number $pag    Número da Página
920
     * @param number $totPag Total de páginas
921
     *
922
     * @return number Posição vertical final
923
     */
924
    protected function header($x = 0, $y = 0, $pag = '1', $totPag = '1')
925
    {
926
        $oldX = $x;
927
        $oldY = $y;
928
        if ($this->orientacao == 'P') {
929
            $maxW = $this->wPrint;
930
        } else {
931
            if ($pag == 1) { // primeira página
932
                $maxW = $this->wPrint - $this->wCanhoto;
933
            } else { // páginas seguintes
934
                $maxW = $this->wPrint;
935
            }
936
        }
937
        //####################################################################################
938
        //coluna esquerda identificação do emitente
939
        $w = round($maxW * 0.41, 0);
940
        if ($this->orientacao == 'P') {
941
            $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I'];
942
        } else {
943
            $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
944
        }
945
        $w1   = $w;
946
        $h    = 32;
947
        $oldY += $h;
948
        $this->pdf->textBox($x, $y, $w, $h);
949
        $texto = 'IDENTIFICAÇÃO DO EMITENTE';
950
        $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...
951
        //estabelecer o alinhamento
952
        //pode ser left L, center C, right R, full logo L
953
        //se for left separar 1/3 da largura para o tamanho da imagem
954
        //os outros 2/3 serão usados para os dados do emitente
955
        //se for center separar 1/2 da altura para o logo e 1/2 para os dados
956
        //se for right separa 2/3 para os dados e o terço seguinte para o logo
957
        //se não houver logo centraliza dos dados do emitente
958
        // coloca o logo
959
        if (! empty($this->logomarca)) {
960
            $logoInfo = getimagesize($this->logomarca);
961
            //largura da imagem em mm
962
            $logoWmm = ($logoInfo[0] / 72) * 25.4;
963
            //altura da imagem em mm
964
            $logoHmm = ($logoInfo[1] / 72) * 25.4;
965
            if ($this->logoAlign == 'L') {
966
                $nImgW = round($w / 3, 0);
967
                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
968
                $xImg  = $x + 1;
969
                $yImg  = round(($h - $nImgH) / 2, 0) + $y;
970
                //estabelecer posições do texto
971
                $x1 = round($xImg + $nImgW + 1, 0);
972
                $y1 = round($h / 3 + $y, 0);
973
                $tw = round(2 * $w / 3, 0);
974
            } elseif ($this->logoAlign == 'C') {
975
                $nImgH = round($h / 3, 0);
976
                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
977
                $xImg  = round(($w - $nImgW) / 2 + $x, 0);
978
                $yImg  = $y + 3;
979
                $x1    = $x;
980
                $y1    = round($yImg + $nImgH + 1, 0);
981
                $tw    = $w;
982
            } elseif ($this->logoAlign == 'R') {
983
                $nImgW = round($w / 3, 0);
984
                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
985
                $xImg  = round($x + ($w - (1 + $nImgW)), 0);
986
                $yImg  = round(($h - $nImgH) / 2, 0) + $y;
987
                $x1    = $x;
988
                $y1    = round($h / 3 + $y, 0);
989
                $tw    = round(2 * $w / 3, 0);
990
            } elseif ($this->logoAlign == 'F') {
991
                $nImgH = round($h - 5, 0);
992
                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
993
                $xImg  = round(($w - $nImgW) / 2 + $x, 0);
994
                $yImg  = $y + 3;
995
                $x1    = $x;
996
                $y1    = round($yImg + $nImgH + 1, 0);
997
                $tw    = $w;
998
            }
999
            $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...
1000
            $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg');
0 ignored issues
show
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...
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...
1001
        } else {
1002
            $x1 = $x;
1003
            $y1 = round($h / 3 + $y, 0);
1004
            $tw = $w;
1005
        }
1006
        // monta as informações apenas se diferente de full logo
1007
        if ($this->logoAlign !== 'F') {
1008
            //Nome emitente
1009
            $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B'];
1010
            $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
1011
            $this->pdf->textBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
0 ignored issues
show
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...
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...
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...
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...
1012
            //endereço
1013
            $y1     = $y1 + 5;
1014
            $aFont  = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
1015
            $fone   = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1016
                ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
1017
                : '';
1018
            $lgr    = $this->getTagValue($this->enderEmit, "xLgr");
1019
            $nro    = $this->getTagValue($this->enderEmit, "nro");
1020
            $cpl    = $this->getTagValue($this->enderEmit, "xCpl", " - ");
1021
            $bairro = $this->getTagValue($this->enderEmit, "xBairro");
1022
            $CEP    = $this->getTagValue($this->enderEmit, "CEP");
1023
            $CEP    = $this->formatField($CEP, "#####-###");
1024
            $mun    = $this->getTagValue($this->enderEmit, "xMun");
1025
            $UF     = $this->getTagValue($this->enderEmit, "UF");
1026
            $texto  = $lgr . ", " . $nro . $cpl . "\n" . $bairro . " - "
1027
                . $CEP . "\n" . $mun . " - " . $UF . " "
1028
                . "Fone/Fax: " . $fone;
1029
            $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...
1030
        }
1031
1032
        //####################################################################################
1033
        //coluna central Danfe
1034
        $x  += $w;
1035
        $w  = round($maxW * 0.17, 0);//35;
1036
        $w2 = $w;
1037
        $h  = 32;
1038
        $this->pdf->textBox($x, $y, $w, $h);
1039
1040
        $texto = "DANFE";
1041
        $aFont = ['font' => $this->fontePadrao, 'size' => 14, 'style' => 'B'];
1042
        $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...
1043
        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
1044
        $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
1045
        $h     = 20;
1046
        $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...
1047
1048
        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
1049
        $texto = '0 - ENTRADA';
1050
        $y1    = $y + 14;
1051
        $h     = 8;
1052
        $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...
1053
        $texto = '1 - SAÍDA';
1054
        $y1    = $y + 17;
1055
        $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...
1056
        //tipo de nF
1057
        $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B'];
1058
        $y1    = $y + 13;
1059
        $h     = 7;
1060
        $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
1061
        $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...
1062
        //numero da NF
1063
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1064
        $y1    = $y + 20;
1065
        $numNF = str_pad(
1066
            $this->ide->getElementsByTagName('nNF')->item(0)->nodeValue,
1067
            9,
1068
            "0",
1069
            STR_PAD_LEFT
1070
        );
1071
        $numNF = $this->formatField($numNF, "###.###.###");
1072
        $texto = "Nº. " . $numNF;
1073
        $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...
1074
        //Série
1075
        $y1    = $y + 23;
1076
        $serie = str_pad(
1077
            $this->ide->getElementsByTagName('serie')->item(0)->nodeValue,
1078
            3,
1079
            "0",
1080
            STR_PAD_LEFT
1081
        );
1082
        $texto = "Série " . $serie;
1083
        $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...
1084
        //numero paginas
1085
        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'I'];
1086
        $y1    = $y + 26;
1087
        $texto = "Folha " . $pag . "/" . $totPag;
1088
        $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...
1089
1090
        //####################################################################################
1091
        //coluna codigo de barras
1092
        $x  += $w;
1093
        $w  = ($maxW - $w1 - $w2);//85;
1094
        $w3 = $w;
1095
        $h  = 32;
1096
        $this->pdf->textBox($x, $y, $w, $h);
1097
        $this->pdf->setFillColor(0, 0, 0);
1098
        $chave_acesso = str_replace('NFe', '', $this->infNFe->getAttribute("Id"));
1099
        $bW           = 75;
1100
        $bH           = 12;
1101
        //codigo de barras
1102
        $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
1103
        //linhas divisorias
1104
        $this->pdf->line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH);
1105
        $this->pdf->line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH);
1106
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1107
        $y1    = $y + 4 + $bH;
1108
        $h     = 7;
1109
        $texto = 'CHAVE DE ACESSO';
1110
        $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...
1111
        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
1112
        $y1    = $y + 8 + $bH;
1113
        $texto = $this->formatField($chave_acesso, $this->formatoChave);
1114
        $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...
1115
        $y1                = $y + 12 + $bH;
1116
        $aFont             = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
1117
        $chaveContingencia = "";
1118
        if (!empty($this->epec)) {
1119
            $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO EPEC';
1120
        } else {
1121
            $cabecalhoProtoAutorizacao = 'PROTOCOLO DE AUTORIZAÇÃO DE USO';
1122
        }
1123
        if (($this->tpEmis == 2 || $this->tpEmis == 5) && empty($this->epec)) {
1124
            $cabecalhoProtoAutorizacao = "DADOS DA NF-E";
1125
            $chaveContingencia         = $this->geraChaveAdicionalDeContingencia();
1126
            $this->pdf->setFillColor(0, 0, 0);
1127
            //codigo de barras
1128
            $this->pdf->code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2);
1129
        } else {
1130
            $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1131
            $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...
1132
            $y1    = $y + 16 + $bH;
1133
            $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1134
            $this->pdf->textBox(
1135
                $x + 2,
1136
                $y1,
1137
                $w - 2,
1138
                $h,
1139
                $texto,
1140
                $aFont,
1141
                'T',
1142
                'C',
1143
                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...
1144
                'http://www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora'
1145
            );
1146
        }
1147
1148
        //####################################################################################
1149
        //Dados da NF do cabeçalho
1150
        //natureza da operação
1151
        $texto = 'NATUREZA DA OPERAÇÃO';
1152
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1153
        $w     = $w1 + $w2;
1154
        $y     = $oldY;
1155
        $oldY  += $h;
1156
        $x     = $oldX;
1157
        $h     = 7;
1158
        $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...
1159
        $texto = $this->ide->getElementsByTagName("natOp")->item(0)->nodeValue;
1160
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1161
        $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...
1162
        $x += $w;
1163
        $w = $w3;
1164
        //PROTOCOLO DE AUTORIZAÇÃO DE USO ou DADOS da NF-E
1165
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1166
        $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...
1167
        // algumas NFe podem estar sem o protocolo de uso portanto sua existencia deve ser
1168
        // testada antes de tentar obter a informação.
1169
        // NOTA : DANFE sem protocolo deve existir somente no caso de contingência !!!
1170
        // Além disso, existem várias NFes em contingência que eu recebo com protocolo de autorização.
1171
        // Na minha opinião, deveríamos mostra-lo, mas o  manual  da NFe v4.01 diz outra coisa...
1172
        if (($this->tpEmis == 2 || $this->tpEmis == 5) && empty($this->epec)) {
1173
            $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
1174
            $texto = $this->formatField(
1175
                $chaveContingencia,
1176
                "#### #### #### #### #### #### #### #### ####"
1177
            );
1178
            $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...
1179
        } else {
1180
            $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1181
            if (!empty($this->epec)) {
1182
                $texto = $this->epec['protocolo'] . ' - ' . $this->epec['data'];
1183
                $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...
1184
            } else {
1185
                if (isset($this->nfeProc)) {
1186
                    $texto  = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue)
1187
                        ? $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue
1188
                        : '';
1189
                    $tsHora = $this->toTimestamp(
1190
                        $this->nfeProc->getElementsByTagName("dhRecbto")->item(0)->nodeValue
1191
                    );
1192
                    if ($texto != '') {
1193
                        $texto .= "  -  " . date('d/m/Y H:i:s', $tsHora);
1194
                    }
1195
                    $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...
1196
                } else {
1197
                    $texto = '';
1198
                    $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...
1199
                }
1200
            }
1201
        }
1202
        $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...
1203
        //####################################################################################
1204
        //INSCRIÇÃO ESTADUAL
1205
        $w     = round($maxW * 0.250, 0);
1206
        $y     += $h;
1207
        $oldY  += $h;
1208
        $x     = $oldX;
1209
        $texto = 'INSCRIÇÃO ESTADUAL';
1210
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1211
        $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...
1212
        $texto = $this->getTagValue($this->emit, "IE");
1213
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1214
        $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...
1215
        //INSCRIÇÃO MUNICIPAL
1216
        $x     += $w;
1217
        $texto = 'INSCRIÇÃO MUNICIPAL';
1218
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1219
        $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...
1220
        $texto = $this->getTagValue($this->emit, "IM");
1221
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1222
        $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...
1223
        //INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.
1224
        $x     += $w;
1225
        $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.';
1226
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1227
        $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...
1228
        $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1229
            ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue
1230
            : '';
1231
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1232
        $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...
1233
        //CNPJ
1234
        $x     += $w;
1235
        $w     = ($maxW - (3 * $w));
1236
        $texto = 'CNPJ';
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
        //Pegando valor do CPF/CNPJ
1240
        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1241
            $texto = $this->formatField(
1242
                $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1243
                "###.###.###/####-##"
1244
            );
1245
        } else {
1246
            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue)
1247
                ? $this->formatField(
1248
                    $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1249
                    "###.###.###-##"
1250
                )
1251
                : '';
1252
        }
1253
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1254
        $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...
1255
1256
        //####################################################################################
1257
        //Indicação de NF Homologação, cancelamento e falta de protocolo
1258
        $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...
1259
        //indicar cancelamento
1260
        $resp = $this->statusNFe();
1261
        if (!$resp['status']) {
1262
            $n = count($resp['message']);
1263
            $alttot = $n * 15;
1264
            $x = 10;
1265
            $y = $this->hPrint/2 - $alttot/2;
1266
            $h = 15;
1267
            $w = $maxW - (2 * $x);
1268
            $this->pdf->settextcolor(90, 90, 90);
1269
            
1270
            foreach ($resp['message'] as $msg) {
1271
                $aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B'];
1272
                $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...
1273
                $y += $h;
1274
            }
1275
            $texto = $resp['submessage'];
1276
            if (!empty($texto)) {
1277
                $y += 3;
1278
                $h = 5;
1279
                $aFont = ['font' => $this->fontePadrao, 'size' => 20, 'style' => 'B'];
1280
                $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...
1281
                $y += $h;
1282
            }
1283
            $y += 5;
1284
            $w = $maxW - (2 * $x);
1285
            $texto = "SEM VALOR FISCAL";
1286
            $aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B'];
1287
            $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...
1288
            $this->pdf->settextcolor(0, 0, 0);
1289
        }
1290
        if (!empty($this->epec) || $this->tpEmis == 4) {
1291
            //EPEC
1292
            $x = 10;
1293
            $y = $this->hPrint - 130;
1294
            $h = 25;
1295
            $w = $maxW - (2 * $x);
1296
            $this->pdf->SetTextColor(200, 200, 200);
1297
            $texto = "DANFE impresso em contingência -\n" .
1298
                "EPEC regularmente recebido pela Receita\n" .
1299
                "Federal do Brasil";
1300
            $aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B'];
1301
            $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...
1302
            $this->pdf->SetTextColor(0, 0, 0);
1303
        }
1304
1305
        return $oldY;
1306
    } //fim header
1307
1308
    /**
1309
     * destinatarioDANFE
1310
     * Monta o campo com os dados do destinatário na DANFE. (retrato e paisagem)
1311
     *
1312
     * @name   destinatarioDANFE
1313
     *
1314
     * @param number $x Posição horizontal canto esquerdo
1315
     * @param number $y Posição vertical canto superior
1316
     *
1317
     * @return number Posição vertical final
1318
     */
1319
    protected function destinatarioDANFE($x = 0, $y = 0)
1320
    {
1321
        //####################################################################################
1322
        //DESTINATÁRIO / REMETENTE
1323
        $oldX = $x;
1324
        $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...
1325
        if ($this->orientacao == 'P') {
1326
            $maxW = $this->wPrint;
1327
        } else {
1328
            $maxW = $this->wPrint - $this->wCanhoto;
1329
        }
1330
        $w     = $maxW;
1331
        $h     = 7;
1332
        $texto = 'DESTINATÁRIO / REMETENTE';
1333
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1334
        $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...
1335
        //NOME / RAZÃO SOCIAL
1336
        $w     = round($maxW * 0.61, 0);
1337
        $w1    = $w;
1338
        $y     += 3;
1339
        $texto = 'NOME / RAZÃO SOCIAL';
1340
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1341
        $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...
1342
        $texto = $this->dest->getElementsByTagName("xNome")->item(0)->nodeValue;
1343
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1344
        if ($this->orientacao == 'P') {
1345
            $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...
1346
        } else {
1347
            $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...
1348
        }
1349
        //CNPJ / CPF
1350
        $x     += $w;
1351
        $w     = round($maxW * 0.23, 0);
1352
        $w2    = $w;
1353
        $texto = 'CNPJ / CPF';
1354
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1355
        $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...
1356
        //Pegando valor do CPF/CNPJ
1357
        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1358
            $texto = $this->formatField(
1359
                $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1360
                "###.###.###/####-##"
1361
            );
1362
        } else {
1363
            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue)
1364
                ? $this->formatField(
1365
                    $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1366
                    "###.###.###-##"
1367
                )
1368
                : '';
1369
        }
1370
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1371
        $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...
1372
        //DATA DA EMISSÃO
1373
        $x     += $w;
1374
        $w     = $maxW - ($w1 + $w2);
1375
        $wx    = $w;
1376
        $texto = 'DATA DA EMISSÃO';
1377
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1378
        $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...
1379
        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue)
1380
            ? $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue
1381
            : '';
1382
        if ($dEmi == '') {
1383
            $dEmi  = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue)
1384
                ? $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue
1385
                : '';
1386
            $aDemi = explode('T', $dEmi);
1387
            $dEmi  = $aDemi[0];
1388
        }
1389
        $texto = $this->ymdTodmy($dEmi);
1390
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1391
        if ($this->orientacao == 'P') {
1392
            $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...
1393
        } else {
1394
            $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...
1395
        }
1396
        //ENDEREÇO
1397
        $w     = round($maxW * 0.47, 0);
1398
        $w1    = $w;
1399
        $y     += $h;
1400
        $x     = $oldX;
1401
        $texto = 'ENDEREÇO';
1402
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1403
        $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...
1404
        $texto = $this->dest->getElementsByTagName("xLgr")->item(0)->nodeValue;
1405
        $texto .= ', ' . $this->dest->getElementsByTagName("nro")->item(0)->nodeValue;
1406
        $texto .= $this->getTagValue($this->dest, "xCpl", " - ");
1407
1408
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1409
        $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...
1410
        //BAIRRO / DISTRITO
1411
        $x     += $w;
1412
        $w     = round($maxW * 0.21, 0);
1413
        $w2    = $w;
1414
        $texto = 'BAIRRO / DISTRITO';
1415
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1416
        $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...
1417
        $texto = $this->dest->getElementsByTagName("xBairro")->item(0)->nodeValue;
1418
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1419
        $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...
1420
        //CEP
1421
        $x     += $w;
1422
        $w     = $maxW - $w1 - $w2 - $wx;
1423
        $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...
1424
        $texto = 'CEP';
1425
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1426
        $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...
1427
        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue)
1428
            ? $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue
1429
            : '';
1430
        $texto = $this->formatField($texto, "#####-###");
1431
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1432
        $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...
1433
        //DATA DA SAÍDA
1434
        $x     += $w;
1435
        $w     = $wx;
1436
        $texto = 'DATA DA SAÍDA/ENTRADA';
1437
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1438
        $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...
1439
        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue)
1440
            ? $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue
1441
            : '';
1442
        if ($dSaiEnt == '') {
1443
            $dSaiEnt  = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1444
                ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1445
                : '';
1446
            $aDsaient = explode('T', $dSaiEnt);
1447
            $dSaiEnt  = $aDsaient[0];
1448
        }
1449
        $texto = $this->ymdTodmy($dSaiEnt);
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
        //MUNICÍPIO
1453
        $w     = $w1;
1454
        $y     += $h;
1455
        $x     = $oldX;
1456
        $texto = 'MUNICÍPIO';
1457
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1458
        $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...
1459
        $texto = $this->dest->getElementsByTagName("xMun")->item(0)->nodeValue;
1460
        if (strtoupper(trim($texto)) == "EXTERIOR"
1461
            && $this->dest->getElementsByTagName("xPais")->length > 0
1462
        ) {
1463
            $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1464
        }
1465
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1466
        $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...
1467
        //UF
1468
        $x     += $w;
1469
        $w     = 8;
1470
        $texto = 'UF';
1471
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1472
        $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...
1473
        $texto = $this->dest->getElementsByTagName("UF")->item(0)->nodeValue;
1474
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1475
        $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...
1476
        //FONE / FAX
1477
        $x     += $w;
1478
        $w     = round(($maxW - $w1 - $wx - 8) / 2, 0);
1479
        $w3    = $w;
1480
        $texto = 'FONE / FAX';
1481
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1482
        $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...
1483
        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue)
1484
            ? $this->dest->getElementsByTagName("fone")->item(0)->nodeValue
1485
            : '';
1486
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1487
        $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...
1488
        //INSCRIÇÃO ESTADUAL
1489
        $x     += $w;
1490
        $w     = $maxW - $w1 - $wx - 8 - $w3;
1491
        $texto = 'INSCRIÇÃO ESTADUAL';
1492
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1493
        $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...
1494
        $IE    = $this->dest->getElementsByTagName("IE");
1495
        $texto = ($IE && $IE->length > 0) ? $IE->item(0)->nodeValue : '';
1496
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1497
        $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...
1498
        //HORA DA SAÍDA
1499
        $x     += $w;
1500
        $w     = $wx;
1501
        $texto = 'HORA DA SAÍDA/ENTRADA';
1502
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1503
        $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...
1504
        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue)
1505
            ? $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue
1506
            : '';
1507
        if ($hSaiEnt == '') {
1508
            $dhSaiEnt   = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1509
                ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1510
                : '';
1511
            $tsDhSaiEnt = $this->toTimestamp($dhSaiEnt);
1512
            if ($tsDhSaiEnt != '') {
1513
                $hSaiEnt = date('H:i:s', $tsDhSaiEnt);
1514
            }
1515
        }
1516
        $texto = $hSaiEnt;
1517
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1518
        $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...
1519
1520
        return ($y + $h);
1521
    } //fim da função destinatarioDANFE
1522
1523
    /**
1524
     * localEntregaDANFE
1525
     * Monta o campo com os dados do local de entrega na DANFE. (retrato e paisagem)
1526
     *
1527
     * @name   localEntregaDANFE
1528
     *
1529
     * @param number $x Posição horizontal canto esquerdo
1530
     * @param number $y Posição vertical canto superior
1531
     *
1532
     * @return number Posição vertical final
1533
     */
1534
    protected function localEntregaDANFE($x = 0, $y = 0)
1535
    {
1536
        //####################################################################################
1537
        //LOCAL DE ENTREGA
1538
        $oldX = $x;
1539
        if ($this->orientacao == 'P') {
1540
            $maxW = $this->wPrint;
1541
        } else {
1542
            $maxW = $this->wPrint - $this->wCanhoto;
1543
        }
1544
        $w     = $maxW;
1545
        $h     = 7;
1546
        $texto = 'INFORMAÇÕES DO LOCAL DE ENTREGA';
1547
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1548
        $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...
1549
        //NOME / RAZÃO SOCIAL
1550
        $w     = round($maxW * 0.61, 0);
1551
        $w1    = $w;
1552
        $y     += 3;
1553
        $texto = 'NOME / RAZÃO SOCIAL';
1554
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1555
        $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...
1556
        $texto = '';
1557
        if ($this->entrega->getElementsByTagName("xNome")->item(0)) {
1558
            $texto = $this->entrega->getElementsByTagName("xNome")->item(0)->nodeValue;
1559
        }
1560
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1561
        if ($this->orientacao == 'P') {
1562
            $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...
1563
        } else {
1564
            $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...
1565
        }
1566
        //CNPJ / CPF
1567
        $x     += $w;
1568
        $w     = round($maxW * 0.23, 0);
1569
        $w2    = $w;
1570
        $texto = 'CNPJ / CPF';
1571
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1572
        $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...
1573
        //Pegando valor do CPF/CNPJ
1574
        if (! empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1575
            $texto = $this->formatField(
1576
                $this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1577
                "###.###.###/####-##"
1578
            );
1579
        } else {
1580
            $texto = ! empty($this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1581
                $this->formatField(
1582
                    $this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue,
1583
                    "###.###.###-##"
1584
                ) : '';
1585
        }
1586
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1587
        $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...
1588
        //INSCRIÇÃO ESTADUAL
1589
        $x     += $w;
1590
        $w     = $maxW - ($w1 + $w2);
1591
        $wx    = $w;
1592
        $texto = 'INSCRIÇÃO ESTADUAL';
1593
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1594
        $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...
1595
        $texto = '';
1596
        if ($this->entrega->getElementsByTagName("IE")->item(0)) {
1597
            $texto = $this->entrega->getElementsByTagName("IE")->item(0)->nodeValue;
1598
        }
1599
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1600
        if ($this->orientacao == 'P') {
1601
            $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...
1602
        } else {
1603
            $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...
1604
        }
1605
        //ENDEREÇO
1606
        $w     = round($maxW * 0.355, 0) + $wx;
1607
        $w1    = $w;
1608
        $y     += $h;
1609
        $x     = $oldX;
1610
        $texto = 'ENDEREÇO';
1611
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1612
        $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...
1613
        $texto = $this->entrega->getElementsByTagName("xLgr")->item(0)->nodeValue;
1614
        $texto .= ', ' . $this->entrega->getElementsByTagName("nro")->item(0)->nodeValue;
1615
        $texto .= $this->getTagValue($this->entrega, "xCpl", " - ");
1616
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1617
        $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...
1618
        //BAIRRO / DISTRITO
1619
        $x     += $w;
1620
        $w     = round($maxW * 0.335, 0);
1621
        $w2    = $w;
1622
        $texto = 'BAIRRO / DISTRITO';
1623
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1624
        $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...
1625
        $texto = $this->entrega->getElementsByTagName("xBairro")->item(0)->nodeValue;
1626
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1627
        $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...
1628
        //CEP
1629
        $x     += $w;
1630
        $w     = $maxW - ($w1 + $w2);
1631
        $texto = 'CEP';
1632
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1633
        $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...
1634
        $texto = ! empty($this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1635
            $this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1636
        $texto = $this->formatField($texto, "#####-###");
1637
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1638
        $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...
1639
        //MUNICÍPIO
1640
        $w     = round($maxW * 0.805, 0);
1641
        $w1    = $w;
1642
        $y     += $h;
1643
        $x     = $oldX;
1644
        $texto = 'MUNICÍPIO';
1645
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1646
        $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...
1647
        $texto = $this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue;
1648
        if (strtoupper(trim($texto)) == "EXTERIOR" && $this->entrega->getElementsByTagName("xPais")->length > 0) {
1649
            $texto .= " - " . $this->entrega->getElementsByTagName("xPais")->item(0)->nodeValue;
1650
        }
1651
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1652
        $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...
1653
        //UF
1654
        $x     += $w;
1655
        $w     = 8;
1656
        $texto = 'UF';
1657
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1658
        $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...
1659
        $texto = $this->entrega->getElementsByTagName("UF")->item(0)->nodeValue;
1660
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1661
        $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...
1662
        //FONE / FAX
1663
        $x     += $w;
1664
        $w     = $maxW - $w - $w1;
1665
        $texto = 'FONE / FAX';
1666
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1667
        $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...
1668
        $texto = ! empty($this->entrega->getElementsByTagName("fone")->item(0)->nodeValue) ?
1669
            $this->entrega->getElementsByTagName("fone")->item(0)->nodeValue : '';
1670
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1671
        $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...
1672
1673
        return ($y + $h);
1674
    } //fim da função localEntregaDANFE
1675
1676
    /**
1677
     * localretiradaDANFE
1678
     * Monta o campo com os dados do local de entrega na DANFE. (retrato e paisagem)
1679
     *
1680
     * @name   localretiradaDANFE
1681
     *
1682
     * @param number $x Posição horizontal canto esquerdo
1683
     * @param number $y Posição vertical canto superior
1684
     *
1685
     * @return number Posição vertical final
1686
     */
1687
    protected function localRetiradaDANFE($x = 0, $y = 0)
1688
    {
1689
        //####################################################################################
1690
        //LOCAL DE RETIRADA
1691
        $oldX = $x;
1692
        if ($this->orientacao == 'P') {
1693
            $maxW = $this->wPrint;
1694
        } else {
1695
            $maxW = $this->wPrint - $this->wCanhoto;
1696
        }
1697
        $w     = $maxW;
1698
        $h     = 7;
1699
        $texto = 'INFORMAÇÕES DO LOCAL DE RETIRADA';
1700
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1701
        $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...
1702
        //NOME / RAZÃO SOCIAL
1703
        $w     = round($maxW * 0.61, 0);
1704
        $w1    = $w;
1705
        $y     += 3;
1706
        $texto = 'NOME / RAZÃO SOCIAL';
1707
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1708
        $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...
1709
        $texto = '';
1710
        if ($this->retirada->getElementsByTagName("xNome")->item(0)) {
1711
            $texto = $this->retirada->getElementsByTagName("xNome")->item(0)->nodeValue;
1712
        }
1713
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1714
        if ($this->orientacao == 'P') {
1715
            $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...
1716
        } else {
1717
            $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...
1718
        }
1719
        //CNPJ / CPF
1720
        $x     += $w;
1721
        $w     = round($maxW * 0.23, 0);
1722
        $w2    = $w;
1723
        $texto = 'CNPJ / CPF';
1724
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1725
        $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...
1726
        //Pegando valor do CPF/CNPJ
1727
        if (! empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1728
            $texto = $this->formatField(
1729
                $this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1730
                "###.###.###/####-##"
1731
            );
1732
        } else {
1733
            $texto = ! empty($this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1734
                $this->formatField(
1735
                    $this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue,
1736
                    "###.###.###-##"
1737
                ) : '';
1738
        }
1739
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1740
        $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...
1741
        //INSCRIÇÃO ESTADUAL
1742
        $x     += $w;
1743
        $w     = $maxW - ($w1 + $w2);
1744
        $wx    = $w;
1745
        $texto = 'INSCRIÇÃO ESTADUAL';
1746
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1747
        $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...
1748
        $texto = '';
1749
        if ($this->retirada->getElementsByTagName("IE")->item(0)) {
1750
            $texto = $this->retirada->getElementsByTagName("IE")->item(0)->nodeValue;
1751
        }
1752
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1753
        if ($this->orientacao == 'P') {
1754
            $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...
1755
        } else {
1756
            $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...
1757
        }
1758
        //ENDEREÇO
1759
        $w     = round($maxW * 0.355, 0) + $wx;
1760
        $w1    = $w;
1761
        $y     += $h;
1762
        $x     = $oldX;
1763
        $texto = 'ENDEREÇO';
1764
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1765
        $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...
1766
        $texto = $this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue;
1767
        $texto .= ', ' . $this->retirada->getElementsByTagName("nro")->item(0)->nodeValue;
1768
        $texto .= $this->getTagValue($this->retirada, "xCpl", " - ");
1769
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1770
        $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...
1771
        //BAIRRO / DISTRITO
1772
        $x     += $w;
1773
        $w     = round($maxW * 0.335, 0);
1774
        $w2    = $w;
1775
        $texto = 'BAIRRO / DISTRITO';
1776
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1777
        $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...
1778
        $texto = $this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue;
1779
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1780
        $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...
1781
        //CEP
1782
        $x     += $w;
1783
        $w     = $maxW - ($w1 + $w2);
1784
        $texto = 'CEP';
1785
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1786
        $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...
1787
        $texto = ! empty($this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1788
            $this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1789
        $texto = $this->formatField($texto, "#####-###");
1790
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1791
        $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...
1792
        //MUNICÍPIO
1793
        $w     = round($maxW * 0.805, 0);
1794
        $w1    = $w;
1795
        $y     += $h;
1796
        $x     = $oldX;
1797
        $texto = 'MUNICÍPIO';
1798
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1799
        $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...
1800
        $texto = $this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue;
1801
        if (strtoupper(trim($texto)) == "EXTERIOR" && $this->retirada->getElementsByTagName("xPais")->length > 0) {
1802
            $texto .= " - " . $this->retirada->getElementsByTagName("xPais")->item(0)->nodeValue;
1803
        }
1804
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1805
        $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...
1806
        //UF
1807
        $x     += $w;
1808
        $w     = 8;
1809
        $texto = 'UF';
1810
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1811
        $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...
1812
        $texto = $this->retirada->getElementsByTagName("UF")->item(0)->nodeValue;
1813
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1814
        $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...
1815
        //FONE / FAX
1816
        $x     += $w;
1817
        $w     = $maxW - $w - $w1;
1818
        $texto = 'FONE / FAX';
1819
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1820
        $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...
1821
        $texto = ! empty($this->retirada->getElementsByTagName("fone")->item(0)->nodeValue) ?
1822
            $this->retirada->getElementsByTagName("fone")->item(0)->nodeValue : '';
1823
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1824
        $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...
1825
1826
        return ($y + $h);
1827
    } //fim da função localRetiradaDANFE
1828
1829
    /**
1830
     * getTextoFatura
1831
     * Gera a String do Texto da Fatura
1832
     *
1833
     * @name   getTextoFatura
1834
     * @return uma String com o texto ou "";
1835
     */
1836
    protected function getTextoFatura()
1837
    {
1838
        if (isset($this->cobr)) {
1839
            $fat = $this->cobr->getElementsByTagName("fat")->item(0);
1840
            if (isset($fat)) {
1841
                if (! empty($this->getTagValue($this->ide, "indPag"))) {
1842
                    $textoIndPag = "";
1843
                    $indPag      = $this->getTagValue($this->ide, "indPag");
1844
                    if ($indPag === "0") {
1845
                        $textoIndPag = "Pagamento à Vista - ";
1846
                    } elseif ($indPag === "1") {
1847
                        $textoIndPag = "Pagamento à Prazo - ";
1848
                    }
1849
                    $nFat  = $this->getTagValue($fat, "nFat", "Fatura: ");
1850
                    $vOrig = $this->getTagValue($fat, "vOrig", " Valor Original: ");
1851
                    $vDesc = $this->getTagValue($fat, "vDesc", " Desconto: ");
1852
                    $vLiq  = $this->getTagValue($fat, "vLiq", " Valor Líquido: ");
1853
                    $texto = $textoIndPag . $nFat . $vOrig . $vDesc . $vLiq;
1854
1855
                    return $texto;
1856
                } else {
1857
                    $pag = $this->dom->getElementsByTagName("pag");
1858
                    if ($tPag = $this->getTagValue($pag->item(0), "tPag")) {
1859
                        return $this->tipoPag($tPag);
1860
                    }
1861
                }
1862
            }
1863
        }
1864
        return "";
1865
    }
1866
1867
    /**
1868
     * sizeExtraTextoFatura
1869
     * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata.
1870
     *
1871
     * @name   sizeExtraTextoFatura
1872
     * @return integer
1873
     */
1874
    protected function sizeExtraTextoFatura()
1875
    {
1876
        $textoFatura = $this->getTextoFatura();
1877
        //verificar se existem duplicatas
1878
        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...
1879
            return 10;
1880
        }
1881
1882
        return 0;
1883
    }
1884
1885
    /**
1886
     * fatura
1887
     * Monta o campo de duplicatas da DANFE (retrato e paisagem)
1888
     *
1889
     * @name   fatura
1890
     *
1891
     * @param number $x Posição horizontal canto esquerdo
1892
     * @param number $y Posição vertical canto superior
1893
     *
1894
     * @return number Posição vertical final
1895
     */
1896
    protected function fatura($x, $y)
1897
    {
1898
        $linha       = 1;
1899
        $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...
1900
        $oldx        = $x;
1901
        $textoFatura = $this->getTextoFatura();
1902
        //verificar se existem duplicatas
1903
        if ($this->dup->length > 0 || $textoFatura !== "") {
1904
            //#####################################################################
1905
            //FATURA / DUPLICATA
1906
            $texto = "FATURA / DUPLICATA";
1907
            if ($this->orientacao == 'P') {
1908
                $w = $this->wPrint;
1909
            } else {
1910
                $w = 271;
1911
            }
1912
            $h     = 8;
1913
            $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1914
            $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...
1915
            $y       += 3;
1916
            $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...
1917
            $dupcont = 0;
1918
            $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...
1919
            if ($nFat > 7) {
1920
                $myH = 6;
1921
                $myW = $this->wPrint;
1922
                if ($this->orientacao == 'L') {
1923
                    $myW -= $this->wCanhoto;
1924
                }
1925
                $aFont = ['font' => $this->fontePadrao, 'size' => 9, 'style' => ''];
1926
                $texto = "Existem mais de 7 duplicatas registradas, portanto não "
1927
                    . "serão exibidas, confira diretamente pelo XML.";
1928
                $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...
1929
1930
                return ($y + $h - 3);
1931
            }
1932
            if ($textoFatura !== "" && $this->exibirTextoFatura) {
1933
                $myH = 6;
1934
                $myW = $this->wPrint;
1935
                if ($this->orientacao == 'L') {
1936
                    $myW -= $this->wCanhoto;
1937
                }
1938
                $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
1939
                $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...
1940
                $y += $myH + 1;
1941
            }
1942
            if ($this->orientacao == 'P') {
1943
                $w = round($this->wPrint / 7.018, 0) - 1;
1944
            } else {
1945
                $w = 28;
1946
            }
1947
            $increm = 1;
1948
            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...
1949
                $nDup  = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue)
1950
                    ? $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue
1951
                    : '';
1952
                $dDup  = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
1953
                    ? $this->ymdTodmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
1954
                    : '';
1955
                $vDup  = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue)
1956
                    ? 'R$ ' . number_format(
1957
                        $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
1958
                        2,
1959
                        ",",
1960
                        "."
1961
                    )
1962
                    : '';
1963
                $h     = 8;
1964
                $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...
1965
                if ($nDup != '0' && $nDup != '') {
1966
                    $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1967
                    $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...
1968
                    $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1969
                    $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...
1970
                } else {
1971
                    $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1972
                    $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...
1973
                }
1974
                $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1975
                $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...
1976
                $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1977
                $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...
1978
                $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1979
                $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...
1980
                $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1981
                $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...
1982
                $x       += $w + $increm;
1983
                $dupcont += 1;
1984
                if ($this->orientacao == 'P') {
1985
                    $maxDupCont = 6;
1986
                } else {
1987
                    $maxDupCont = 8;
1988
                }
1989
                if ($dupcont > $maxDupCont) {
1990
                    $y       += 9;
1991
                    $x       = $oldx;
1992
                    $dupcont = 0;
1993
                    $linha   += 1;
1994
                }
1995
                if ($linha == 5) {
1996
                    $linha = 4;
1997
                    break;
1998
                }
1999
            }
2000
            if ($dupcont == 0) {
2001
                $y -= 9;
2002
                $linha --;
2003
            }
2004
2005
            return ($y + $h);
2006
        } else {
2007
            $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...
2008
2009
            return ($y - 2);
2010
        }
2011
    }
2012
2013
    /**
2014
     * pagamento
2015
     * Monta o campo de pagamentos da DANFE (retrato e paisagem) (foi baseada na fatura)
2016
     *
2017
     * @name   pagamento
2018
     *
2019
     * @param number $x Posição horizontal canto esquerdo
2020
     * @param number $y Posição vertical canto superior
2021
     *
2022
     * @return number Posição vertical final
2023
     */
2024
    protected function pagamento($x, $y)
2025
    {
2026
        $linha = 1;
2027
        $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...
2028
        $oldx  = $x;
2029
        //verificar se existem cobranças definidas
2030
        if (isset($this->detPag) && $this->detPag->length > 0) {
2031
            //#####################################################################
2032
            //Tipo de pagamento
2033
            $texto = "PAGAMENTO";
2034
            if ($this->orientacao == 'P') {
2035
                $w = $this->wPrint;
2036
            } else {
2037
                $w = 271;
2038
            }
2039
            $h     = 8;
2040
            $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2041
            $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...
2042
            $y       += 3;
2043
            $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...
2044
            $dupcont = 0;
2045
            if ($this->orientacao == 'P') {
2046
                $w = round($this->wPrint / 7.018, 0) - 1;
2047
            } else {
2048
                $w = 28;
2049
            }
2050
            if ($this->orientacao == 'P') {
2051
                $maxDupCont = 6;
2052
            } else {
2053
                $maxDupCont = 8;
2054
            }
2055
            $increm         = 1;
2056
            $formaPagamento = [
2057
                '01' => 'Dinheiro',
2058
                '02' => 'Cheque',
2059
                '03' => 'Cartão de Crédito',
2060
                '04' => 'Cartão de Débito',
2061
                '05' => 'Crédito Loja',
2062
                '10' => 'Vale Alimentação',
2063
                '11' => 'Vale Refeição',
2064
                '12' => 'Vale Presente',
2065
                '13' => 'Vale Combustível',
2066
                '14' => 'Duplicata Mercantil',
2067
                '15' => 'Boleto',
2068
                '16' => 'Depósito Bancário',
2069
                '17' => 'Pagamento Instantâneo (PIX)',
2070
                '18' => 'Transferência bancária, Carteira Digital',
2071
                '19' => 'Programa de fidelidade, Cashback, Crédito Virtual',
2072
                '90' => 'Sem pagamento',
2073
                '99' => 'Outros'
2074
            ];
2075
            $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...
2076
                '01' => 'Visa',
2077
                '02' => 'Mastercard',
2078
                '03' => 'American',
2079
                '04' => 'Sorocred',
2080
                '05' => 'Diners',
2081
                '06' => 'Elo',
2082
                '07' => 'Hipercard',
2083
                '08' => 'Aura',
2084
                '09' => 'Cabal',
2085
                '99' => 'Outros'
2086
            ];
2087
            foreach ($this->detPag as $k => $d) {
2088
                $fPag  = ! empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
2089
                    ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue
2090
                    : '0';
2091
                $vPag  = ! empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
2092
                    ? 'R$ ' . number_format(
2093
                        $this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue,
2094
                        2,
2095
                        ",",
2096
                        "."
2097
                    )
2098
                    : '';
2099
                $h     = 6;
2100
                $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...
2101
                if (isset($formaPagamento[$fPag])) {
2102
                    /*Exibir Item sem pagamento*/
2103
                    if ($fPag == '90') {
2104
                        continue;
2105
                    }
2106
                    $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2107
                    $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...
2108
                    $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2109
                    $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...
2110
                } else {
2111
                    $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
2112
                    $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...
2113
                }
2114
                $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2115
                $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...
2116
                $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2117
                $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...
2118
                $x       += $w + $increm;
2119
                $dupcont += 1;
2120
2121
                if ($dupcont > $maxDupCont) {
2122
                    $y       += 9;
2123
                    $x       = $oldx;
2124
                    $dupcont = 0;
2125
                    $linha   += 1;
2126
                }
2127
                if ($linha == 5) {
2128
                    $linha = 4;
2129
                    break;
2130
                }
2131
            }
2132
            if ($dupcont == 0) {
2133
                $y -= 9;
2134
                $linha --;
2135
            }
2136
2137
            return ($y + $h);
2138
        } else {
2139
            $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...
2140
2141
            return ($y - 2);
2142
        }
2143
    } //fim da função pagamento
2144
2145
    /**
2146
     * impostoHelper
2147
     * Auxilia a montagem dos campos de impostos e totais da DANFE
2148
     *
2149
     * @name   impostoHelper
2150
     *
2151
     * @param float $x Posição horizontal canto esquerdo
2152
     * @param float $y Posição vertical canto superior
2153
     * @param float $w Largura do campo
2154
     * @param float $h Altura do campo
2155
     * @param float $h Título do campo
2156
     * @param float $h Valor do imposto
2157
     *
2158
     * @return float Sugestão do $x do próximo imposto
2159
     */
2160
    protected function impostoHelper($x, $y, $w, $h, $titulo, $campoImposto)
2161
    {
2162
        $valorImposto = '0,00';
2163
        $the_field    = $this->ICMSTot->getElementsByTagName($campoImposto)->item(0);
2164
        if (isset($the_field)) {
2165
            $the_value = $the_field->nodeValue;
2166
            if (! empty($the_value)) {
2167
                $valorImposto = number_format($the_value, 2, ",", ".");
2168
            }
2169
        }
2170
2171
        $fontTitulo = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2172
        $fontValor  = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2173
        $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...
2174
        $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...
2175
2176
        $next_x = $x + $w;
2177
2178
        return $next_x;
2179
    }
2180
2181
    /**
2182
     * imposto
2183
     * Monta o campo de impostos e totais da DANFE (retrato e paisagem)
2184
     *
2185
     * @param number $x Posição horizontal canto esquerdo
2186
     * @param number $y Posição vertical canto superior
2187
     *
2188
     * @return number Posição vertical final
2189
     */
2190
    protected function imposto($x, $y)
2191
    {
2192
        $x_inicial = $x;
2193
        //#####################################################################
2194
        $campos_por_linha = 9;
2195
        if (! $this->exibirPIS) {
2196
            $campos_por_linha --;
2197
        }
2198
        if (! $this->exibirIcmsInterestadual) {
2199
            $campos_por_linha -= 2;
2200
        }
2201
2202
        if ($this->orientacao == 'P') {
2203
            $maxW       = $this->wPrint;
2204
            $title_size = 31;
2205
        } else {
2206
            $maxW       = $this->wPrint - $this->wCanhoto;
2207
            $title_size = 40;
2208
        }
2209
        $w = $maxW / $campos_por_linha;
2210
2211
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2212
        $texto = "CÁLCULO DO IMPOSTO";
2213
        $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...
2214
        $y += 3;
2215
        $h = 7;
2216
2217
        $x = $this->impostoHelper($x, $y, $w, $h, "BASE DE CÁLC. DO ICMS", "vBC");
2218
        $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DO ICMS", "vICMS");
2219
        $x = $this->impostoHelper($x, $y, $w, $h, "BASE DE CÁLC. ICMS S.T.", "vBCST");
2220
        $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DO ICMS SUBST.", "vST");
2221
        $x = $this->impostoHelper($x, $y, $w, $h, "V. IMP. IMPORTAÇÃO", "vII");
2222
2223
        if ($this->exibirIcmsInterestadual) {
2224
            $x = $this->impostoHelper($x, $y, $w, $h, "V. ICMS UF REMET.", "vICMSUFRemet");
2225
            $x = $this->impostoHelper($x, $y, $w, $h, "V. FCP UF DEST.", "vFCPUFDest");
2226
        }
2227
2228
        if ($this->exibirPIS) {
2229
            $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DO PIS", "vPIS");
2230
        }
2231
2232
        $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...
2233
2234
        //
2235
2236
        $y += $h;
2237
        $x = $x_inicial;
2238
2239
        $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DO FRETE", "vFrete");
2240
        $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DO SEGURO", "vSeg");
2241
        $x = $this->impostoHelper($x, $y, $w, $h, "DESCONTO", "vDesc");
2242
        $x = $this->impostoHelper($x, $y, $w, $h, "OUTRAS DESPESAS", "vOutro");
2243
        $x = $this->impostoHelper($x, $y, $w, $h, "VALOR TOTAL IPI", "vIPI");
2244
2245
        if ($this->exibirIcmsInterestadual) {
2246
            $x = $this->impostoHelper($x, $y, $w, $h, "V. ICMS UF DEST.", "vICMSUFDest");
2247
            $x = $this->impostoHelper($x, $y, $w, $h, "V. TOT. TRIB.", "vTotTrib");
2248
        }
2249
        if ($this->exibirPIS) {
2250
            $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DA COFINS", "vCOFINS");
2251
        }
2252
        $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...
2253
2254
        return ($y + $h);
2255
    } //fim imposto
2256
2257
    /**
2258
     * transporte
2259
     * Monta o campo de transportes da DANFE (retrato e paisagem)
2260
     *
2261
     * @name   transporte
2262
     *
2263
     * @param float $x Posição horizontal canto esquerdo
2264
     * @param float $y Posição vertical canto superior
2265
     *
2266
     * @return float Posição vertical final
2267
     */
2268
    protected function transporte($x, $y)
2269
    {
2270
        $oldX = $x;
2271
        if ($this->orientacao == 'P') {
2272
            $maxW = $this->wPrint;
2273
        } else {
2274
            $maxW = $this->wPrint - $this->wCanhoto;
2275
        }
2276
        //#####################################################################
2277
        //TRANSPORTADOR / VOLUMES TRANSPORTADOS
2278
        $texto = "TRANSPORTADOR / VOLUMES TRANSPORTADOS";
2279
        $w     = $maxW;
2280
        $h     = 7;
2281
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2282
        $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...
2283
        //NOME / RAZÃO SOCIAL
2284
        $w1    = $maxW * 0.29;
2285
        $y     += 3;
2286
        $texto = 'NOME / RAZÃO SOCIAL';
2287
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2288
        $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...
2289
        if (isset($this->transporta)) {
2290
            $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue)
2291
                ? $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue
2292
                : '';
2293
        } else {
2294
            $texto = '';
2295
        }
2296
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2297
        $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...
2298
        //FRETE POR CONTA
2299
        $x     += $w1;
2300
        $w2    = $maxW * 0.15;
2301
        $texto = 'FRETE';
2302
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2303
        $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...
2304
        $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue)
2305
            ? $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue
2306
            : '0';
2307
        switch ($tipoFrete) {
2308
            case 0:
2309
                $texto = "0-Por conta do Rem";
2310
                break;
2311
            case 1:
2312
                $texto = "1-Por conta do Dest";
2313
                break;
2314
            case 2:
2315
                $texto = "2-Por conta de Terceiros";
2316
                break;
2317
            case 3:
2318
                $texto = "3-Próprio por conta do Rem";
2319
                break;
2320
            case 4:
2321
                $texto = "4-Próprio por conta do Dest";
2322
                break;
2323
            case 9:
2324
                $texto = "9-Sem Transporte";
2325
                break;
2326
        }
2327
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2328
        $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...
2329
        //CÓDIGO ANTT
2330
        $x     += $w2;
2331
        $texto = 'CÓDIGO ANTT';
2332
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2333
        $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...
2334
        if (isset($this->veicTransp)) {
2335
            $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue)
2336
                ? $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue
2337
                : '';
2338
        } else {
2339
            $texto = '';
2340
        }
2341
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2342
        $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...
2343
        //PLACA DO VEÍC
2344
        $x     += $w2;
2345
        $texto = 'PLACA DO VEÍCULO';
2346
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2347
        $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...
2348
        if (isset($this->veicTransp)) {
2349
            $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue)
2350
                ? $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue
2351
                : '';
2352
        } elseif (isset($this->reboque)) {
2353
            $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue)
2354
                ? $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue
2355
                : '';
2356
        } else {
2357
            $texto = '';
2358
        }
2359
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2360
        $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...
2361
        //UF
2362
        $x     += $w2;
2363
        $w3    = round($maxW * 0.04, 0);
2364
        $texto = 'UF';
2365
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2366
        $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...
2367
        if (isset($this->veicTransp)) {
2368
            $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue)
2369
                ? $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue
2370
                : '';
2371
        } elseif (isset($this->reboque)) {
2372
            $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue)
2373
                ? $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue
2374
                : '';
2375
        } else {
2376
            $texto = '';
2377
        }
2378
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2379
        $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...
2380
        //CNPJ / CPF
2381
        $x     += $w3;
2382
        $w     = $maxW - ($w1 + 3 * $w2 + $w3);
2383
        $texto = 'CNPJ / CPF';
2384
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2385
        $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...
2386
        if (isset($this->transporta)) {
2387
            $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue)
2388
                ? $this->formatField(
2389
                    $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,
2390
                    "##.###.###/####-##"
2391
                )
2392
                : '';
2393
            if ($texto == '') {
2394
                $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue)
2395
                    ? $this->formatField(
2396
                        $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue,
2397
                        "###.###.###-##"
2398
                    )
2399
                    : '';
2400
            }
2401
        } else {
2402
            $texto = '';
2403
        }
2404
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2405
        $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...
2406
        //#####################################################################
2407
        //ENDEREÇO
2408
        $y     += $h;
2409
        $x     = $oldX;
2410
        $h     = 7;
2411
        $w1    = $maxW * 0.44;
2412
        $texto = 'ENDEREÇO';
2413
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2414
        $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...
2415
        if (isset($this->transporta)) {
2416
            $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue)
2417
                ? $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue
2418
                : '';
2419
        } else {
2420
            $texto = '';
2421
        }
2422
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2423
        $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...
2424
        //MUNICÍPIO
2425
        $x     += $w1;
2426
        $w2    = round($maxW * 0.30, 0);
2427
        $texto = 'MUNICÍPIO';
2428
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2429
        $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...
2430
        if (isset($this->transporta)) {
2431
            $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue)
2432
                ? $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue
2433
                : '';
2434
        } else {
2435
            $texto = '';
2436
        }
2437
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2438
        $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...
2439
        //UF
2440
        $x     += $w2;
2441
        $w3    = round($maxW * 0.04, 0);
2442
        $texto = 'UF';
2443
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2444
        $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...
2445
        if (isset($this->transporta)) {
2446
            $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue)
2447
                ? $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue
2448
                : '';
2449
        } else {
2450
            $texto = '';
2451
        }
2452
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2453
        $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...
2454
        //INSCRIÇÃO ESTADUAL
2455
        $x     += $w3;
2456
        $w     = $maxW - ($w1 + $w2 + $w3);
2457
        $texto = 'INSCRIÇÃO ESTADUAL';
2458
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2459
        $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...
2460
        $texto = '';
2461
        if (isset($this->transporta)) {
2462
            if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2463
                $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue;
2464
            }
2465
        }
2466
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2467
        $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...
2468
        //Tratar Multiplos volumes
2469
        $volumes     = $this->transp->getElementsByTagName('vol');
2470
        $quantidade  = 0;
2471
        $especie     = '';
2472
        $marca       = '';
2473
        $numero      = '';
2474
        $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...
2475
        $pesoBruto   = 0;
2476
        $pesoLiquido = 0;
2477
        foreach ($volumes as $volume) {
2478
            $quantidade  += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2479
                $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0;
2480
            $pesoBruto   += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2481
                $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0;
2482
            $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2483
                $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0;
2484
            $texto       = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2485
                $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';
2486
            if ($texto != $especie && $especie != '') {
2487
                //tem várias especies
2488
                $especie = 'VARIAS';
2489
            } else {
2490
                $especie = $texto;
2491
            }
2492
            $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue)
2493
                ? $this->transp->getElementsByTagName("marca")->item(0)->nodeValue
2494
                : '';
2495
            if ($texto != $marca && $marca != '') {
2496
                //tem várias especies
2497
                $marca = 'VARIAS';
2498
            } else {
2499
                $marca = $texto;
2500
            }
2501
            $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue)
2502
                ? $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue
2503
                : '';
2504
            if ($texto != $numero && $numero != '') {
2505
                //tem várias especies
2506
                $numero = 'VARIOS';
2507
            } else {
2508
                $numero = $texto;
2509
            }
2510
        }
2511
2512
        //#####################################################################
2513
        //QUANTIDADE
2514
        $y     += $h;
2515
        $x     = $oldX;
2516
        $h     = 7;
2517
        $w1    = round($maxW * 0.10, 0);
2518
        $texto = 'QUANTIDADE';
2519
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2520
        $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...
2521
        if (! empty($quantidade)) {
2522
            $texto = $quantidade;
2523
            $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2524
            $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...
2525
        }
2526
        //ESPÉCIE
2527
        $x     += $w1;
2528
        $w2    = round($maxW * 0.17, 0);
2529
        $texto = 'ESPÉCIE';
2530
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2531
        $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...
2532
        $texto = $especie;
2533
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2534
        $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...
2535
        //MARCA
2536
        $x     += $w2;
2537
        $texto = 'MARCA';
2538
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2539
        $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...
2540
        $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2541
            $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2542
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2543
        $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...
2544
        //NUMERAÇÃO
2545
        $x     += $w2;
2546
        $texto = 'NUMERAÇÃO';
2547
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2548
        $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...
2549
        $texto = $numero;
2550
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2551
        $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...
2552
        //PESO BRUTO
2553
        $x     += $w2;
2554
        $w3    = round($maxW * 0.20, 0);
2555
        $texto = 'PESO BRUTO';
2556
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2557
        $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...
2558
        if (is_numeric($pesoBruto) && $pesoBruto > 0) {
2559
            $texto = number_format($pesoBruto, 3, ",", ".");
2560
        } else {
2561
            $texto = '';
2562
        }
2563
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2564
        $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...
2565
        //PESO LÍQUIDO
2566
        $x     += $w3;
2567
        $w     = $maxW - ($w1 + 3 * $w2 + $w3);
2568
        $texto = 'PESO LÍQUIDO';
2569
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2570
        $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...
2571
        if (is_numeric($pesoLiquido) && $pesoLiquido > 0) {
2572
            $texto = number_format($pesoLiquido, 3, ",", ".");
2573
        } else {
2574
            $texto = '';
2575
        }
2576
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2577
        $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...
2578
2579
        return ($y + $h);
2580
    } //fim transporte
2581
2582
2583
    protected function descricaoProdutoHelper($origem, $campo, $formato)
2584
    {
2585
        $valor_original = $origem->getElementsByTagName($campo)->item(0);
2586
        if (! isset($valor_original)) {
2587
            return "";
2588
        }
2589
        $valor_original = $valor_original->nodeValue;
2590
        $valor          = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2591
2592
        if ($valor != "") {
2593
            return sprintf($formato, $valor);
2594
        }
2595
2596
        return "";
2597
    }
2598
2599
    /**
2600
     * descricaoProduto
2601
     * Monta a string de descrição de cada Produto
2602
     *
2603
     * @name   descricaoProduto
2604
     *
2605
     * @param DOMNode itemProd
2606
     *
2607
     * @return string descricao do produto
2608
     */
2609
    protected function descricaoProduto($itemProd)
2610
    {
2611
        $prod       = $itemProd->getElementsByTagName('prod')->item(0);
2612
        $ICMS       = $itemProd->getElementsByTagName("ICMS")->item(0);
2613
        $ICMSUFDest = $itemProd->getElementsByTagName("ICMSUFDest")->item(0);
2614
        $impostos   = '';
2615
2616
        if (! empty($ICMS)) {
2617
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vBCFCP", " BcFcp=%s");
2618
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pFCP", " pFcp=%s%%");
2619
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vFCP", " vFcp=%s");
2620
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pRedBC", " pRedBC=%s%%");
2621
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pMVAST", " IVA/MVA=%s%%");
2622
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pICMSST", " pIcmsSt=%s%%");
2623
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vBCST", " BcIcmsSt=%s");
2624
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vICMSST", " vIcmsSt=%s");
2625
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vBCFCPST", " BcFcpSt=%s");
2626
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pFCPST", " pFcpSt=%s%%");
2627
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vFCPST", " vFcpSt=%s");
2628
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vBCSTRet", " Retido na compra: BASE ICMS ST=%s");
2629
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pST", " pSt=%s");
2630
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vICMSSTRet", " VALOR ICMS ST=%s");
2631
        }
2632
        if (! empty($ICMSUFDest)) {
2633
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "pFCPUFDest", " pFCPUFDest=%s%%");
2634
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "pICMSUFDest", " pICMSUFDest=%s%%");
2635
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "pICMSInterPart", " pICMSInterPart=%s%%");
2636
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vFCPUFDest", " vFCPUFDest=%s");
2637
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
2638
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
2639
        }
2640
        $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue)
2641
            ? substr(
2642
                $this->anfaveaDANFE($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue),
2643
                0,
2644
                500
2645
            )
2646
            : '';
2647
        if (! empty($infAdProd)) {
2648
            $infAdProd = trim($infAdProd);
2649
            $infAdProd .= ' ';
2650
        }
2651
        $loteTxt = '';
2652
        $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...
2653
        if (! empty($prod->getElementsByTagName("rastro"))) {
2654
            $rastro = $prod->getElementsByTagName("rastro");
2655
            $i      = 0;
2656
            while ($i < $rastro->length) {
2657
                $loteTxt .= $this->getTagValue($rastro->item($i), 'nLote', ' Lote: ');
2658
                $loteTxt .= $this->getTagValue($rastro->item($i), 'qLote', ' Quant: ');
2659
                $loteTxt .= $this->getTagDate($rastro->item($i), 'dFab', ' Fab: ');
2660
                $loteTxt .= $this->getTagDate($rastro->item($i), 'dVal', ' Val: ');
2661
                $loteTxt .= $this->getTagValue($rastro->item($i), 'vPMC', ' PMC: ');
2662
                $i ++;
2663
            }
2664
            if ($loteTxt != '') {
2665
                $loteTxt .= ' ';
2666
            }
2667
        }
2668
        //NT2013.006 FCI
2669
        $nFCI   = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2670
            ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2671
        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2672
        $texto  = $prod->getElementsByTagName("xProd")->item(0)->nodeValue
2673
            . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
2674
        //decodifica os caracteres html no xml
2675
        $texto = html_entity_decode($texto);
2676
        if ($this->descProdQuebraLinha) {
2677
            $texto = str_replace(";", "\n", $texto);
2678
        }
2679
2680
        return $texto;
2681
    }
2682
2683
    /**
2684
     * itens
2685
     * Monta o campo de itens da DANFE (retrato e paisagem)
2686
     *
2687
     * @name   itens
2688
     *
2689
     * @param float $x       Posição horizontal canto esquerdo
2690
     * @param float $y       Posição vertical canto superior
2691
     * @param float $nInicio Número do item inicial
2692
     * @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...
2693
     * @param float $hmax    Altura máxima do campo de itens em mm
2694
     *
2695
     * @return float Posição vertical final
2696
     */
2697
    protected function itens($x, $y, &$nInicio, $hmax, $pag = 0, $totpag = 0, $hCabecItens = 7)
2698
    {
2699
        $oldX = $x;
2700
        $oldY = $y;
2701
        $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...
2702
        //#####################################################################
2703
        //DADOS DOS PRODUTOS / SERVIÇOS
2704
        $texto = "DADOS DOS PRODUTOS / SERVIÇOS";
2705
        if ($this->orientacao == 'P') {
2706
            $w = $this->wPrint;
2707
        } else {
2708
            if ($nInicio < 2) { // primeira página
2709
                $w = $this->wPrint - $this->wCanhoto;
2710
            } else { // páginas seguintes
2711
                $w = $this->wPrint;
2712
            }
2713
        }
2714
        $h     = 4;
2715
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2716
        $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...
2717
        $y += 3;
2718
        //desenha a caixa dos dados dos itens da NF
2719
        $hmax  += 1;
2720
        $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...
2721
        $this->pdf->textBox($x, $y, $w, $hmax);
2722
        //##################################################################################
2723
        // cabecalho LOOP COM OS DADOS DOS PRODUTOS
2724
        //CÓDIGO PRODUTO
2725
        $texto = "CÓDIGO PRODUTO";
2726
        $w1    = round($w * 0.09, 0);
2727
        $h     = 4;
2728
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2729
        $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...
2730
        $this->pdf->line($x + $w1, $y, $x + $w1, $y + $hmax);
2731
        //DESCRIÇÃO DO PRODUTO / SERVIÇO
2732
        $x     += $w1;
2733
        $w2    = round($w * 0.25, 0);
2734
        $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO';
2735
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2736
        $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...
2737
        $this->pdf->line($x + $w2, $y, $x + $w2, $y + $hmax);
2738
        //NCM/SH
2739
        $x     += $w2;
2740
        $w3    = round($w * 0.06, 0);
2741
        $texto = 'NCM/SH';
2742
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2743
        $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...
2744
        $this->pdf->line($x + $w3, $y, $x + $w3, $y + $hmax);
2745
        //O/CST ou O/CSOSN
2746
        $x     += $w3;
2747
        $w4    = round($w * 0.05, 0);
2748
        $texto = 'O/CST'; // CRT = 2 ou CRT = 3
2749
        if ($this->getTagValue($this->emit, 'CRT') == '1') {
2750
            $texto = 'O/CSOSN';//Regime do Simples CRT = 1
2751
        }
2752
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2753
        $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...
2754
        $this->pdf->line($x + $w4, $y, $x + $w4, $y + $hmax);
2755
        //CFOP
2756
        $x     += $w4;
2757
        $w5    = round($w * 0.04, 0);
2758
        $texto = 'CFOP';
2759
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2760
        $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...
2761
        $this->pdf->line($x + $w5, $y, $x + $w5, $y + $hmax);
2762
        //UN
2763
        $x     += $w5;
2764
        $w6    = round($w * 0.03, 0);
2765
        $texto = 'UN';
2766
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2767
        $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...
2768
        $this->pdf->line($x + $w6, $y, $x + $w6, $y + $hmax);
2769
        //QUANT
2770
        $x     += $w6;
2771
        $w7    = round($w * 0.08, 0);
2772
        $texto = 'QUANT';
2773
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2774
        $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...
2775
        $this->pdf->line($x + $w7, $y, $x + $w7, $y + $hmax);
2776
        //VALOR UNIT
2777
        $x     += $w7;
2778
        $w8    = round($w * 0.06, 0);
2779
        $texto = 'VALOR UNIT';
2780
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2781
        $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...
2782
        $this->pdf->line($x + $w8, $y, $x + $w8, $y + $hmax);
2783
        //VALOR TOTAL
2784
        $x     += $w8;
2785
        $w9    = round($w * 0.06, 0);
2786
        $texto = 'VALOR TOTAL';
2787
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2788
        $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...
2789
        $this->pdf->line($x + $w9, $y, $x + $w9, $y + $hmax);
2790
        //VALOR DESCONTO
2791
        $x     += $w9;
2792
        $w10   = round($w * 0.05, 0);
2793
        $texto = 'VALOR DESC';
2794
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2795
        $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...
2796
        $this->pdf->line($x + $w10, $y, $x + $w10, $y + $hmax);
2797
        //B.CÁLC ICMS
2798
        $x     += $w10;
2799
        $w11   = round($w * 0.06, 0);
2800
        $texto = 'B.CÁLC ICMS';
2801
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2802
        $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...
2803
        $this->pdf->line($x + $w11, $y, $x + $w11, $y + $hmax);
2804
        //VALOR ICMS
2805
        $x     += $w11;
2806
        $w12   = round($w * 0.06, 0);
2807
        $texto = 'VALOR ICMS';
2808
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2809
        $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...
2810
        $this->pdf->line($x + $w12, $y, $x + $w12, $y + $hmax);
2811
        //VALOR IPI
2812
        $x     += $w12;
2813
        $w13   = round($w * 0.05, 0);
2814
        $texto = 'VALOR IPI';
2815
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2816
        $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...
2817
        $this->pdf->line($x + $w13, $y, $x + $w13, $y + $hmax);
2818
        //ALÍQ. ICMS
2819
        $x     += $w13;
2820
        $w14   = round($w * 0.04, 0);
2821
        $texto = 'ALÍQ. ICMS';
2822
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2823
        $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...
2824
        $this->pdf->line($x + $w14, $y, $x + $w14, $y + $hmax);
2825
        //ALÍQ. IPI
2826
        $x     += $w14;
2827
        $w15   = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13 + $w14);
2828
        $texto = 'ALÍQ. IPI';
2829
        $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...
2830
        $this->pdf->line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1);
2831
        $y += 5;
2832
        //##################################################################################
2833
        // LOOP COM OS DADOS DOS PRODUTOS
2834
        $i      = 0;
2835
        $hUsado = $hCabecItens;
2836
        $aFont  = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
2837
2838
        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...
2839
            if ($i >= $nInicio) {
2840
                $thisItem = $this->det->item($i);
2841
                //carrega as tags do item
2842
                $prod         = $thisItem->getElementsByTagName("prod")->item(0);
2843
                $imposto      = $this->det->item($i)->getElementsByTagName("imposto")->item(0);
2844
                $ICMS         = $imposto->getElementsByTagName("ICMS")->item(0);
2845
                $IPI          = $imposto->getElementsByTagName("IPI")->item(0);
2846
                $textoProduto = $this->descricaoProduto($thisItem);
2847
                
2848
2849
                // Posição y dos dados das unidades tributaveis.
2850
                $yTrib = $this->pdf->fontSize + .5;
2851
2852
                $uCom = $prod->getElementsByTagName("uCom")->item(0)->nodeValue;
2853
                $vUnCom = $prod->getElementsByTagName("vUnCom")->item(0)->nodeValue;
2854
                $uTrib = $prod->getElementsByTagName("uTrib")->item(0);
2855
                $qTrib = $prod->getElementsByTagName("qTrib")->item(0);
2856
                $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...
2857
                $vUnTrib = !empty($prod->getElementsByTagName("vUnTrib")->item(0)->nodeValue)
2858
                    ? $prod->getElementsByTagName("vUnTrib")->item(0)->nodeValue
2859
                    : 0;
2860
                // A Configuração serve para informar se irá exibir
2861
                //   de forma obrigatória, estando diferente ou não,
2862
                //   a unidade de medida tributária.
2863
                // ========
2864
                // A Exibição será realizada sempre que a unidade comercial for
2865
                //   diferente da unidade de medida tributária.
2866
                // "Nas situações em que o valor unitário comercial for diferente do valor unitário tributável,
2867
                //   ambas as informações deverão estar expressas e identificadas no DANFE, podendo ser
2868
                //   utilizada uma das linhas adicionais previstas, ou o campo de informações adicionais."
2869
                // > Manual Integração - Contribuinte 4.01 - NT2009.006, Item 7.1.5, página 91.
2870
                $mostrarUnidadeTributavel = (
2871
                    !empty($uTrib)
2872
                    && !empty($qTrib)
2873
                    && number_format($vUnCom, 2, ',', '') !== number_format($vUnTrib, 2, ',', '')
2874
                );
2875
2876
                // Informação sobre unidade de medida tributavel.
2877
                // Se não for para exibir a unidade de medida tributavel, então
2878
                // A Escrita irá começar em 0.
2879
                if (! $mostrarUnidadeTributavel) {
2880
                    $yTrib = 0;
2881
                }
2882
                $h = $this->calculeHeight($thisItem, $mostrarUnidadeTributavel);
2883
                $hUsado += $h;
2884
2885
                $yTrib += $y;
2886
                $diffH = $hmax - $hUsado;
2887
2888
                if ($pag != $totpag) {
2889
                    if (1 > $diffH && $i < $totItens) {
2890
                        //ultrapassa a capacidade para uma única página
2891
                        //o restante dos dados serão usados nas proximas paginas
2892
                        $nInicio = $i;
2893
                        break;
2894
                    }
2895
                }
2896
                $y_linha = $y + $h;
2897
                // linha entre itens
2898
                $this->pdf->dashedHLine($oldX, $y_linha, $w, 0.1, 120);
2899
                //corrige o x
2900
                $x = $oldX;
2901
                //codigo do produto
2902
                $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...
2903
                $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue;
2904
                $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...
2905
                $x += $w1;
2906
                //DESCRIÇÃO
2907
                if ($this->orientacao == 'P') {
2908
                    $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...
2909
                } else {
2910
                    $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...
2911
                }
2912
                $x += $w2;
2913
                //NCM
2914
                $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2915
                    $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';
2916
                $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...
2917
                $x += $w3;
2918
                //CST
2919
                if (isset($ICMS)) {
2920
                    $origem = $this->getTagValue($ICMS, "orig");
2921
                    $cst    = $this->getTagValue($ICMS, "CST");
2922
                    $csosn  = $this->getTagValue($ICMS, "CSOSN");
2923
                    $texto  = $origem . $cst . $csosn;
2924
                    $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...
2925
                }
2926
                //CFOP
2927
                $x     += $w4;
2928
                $texto = $prod->getElementsByTagName("CFOP")->item(0)->nodeValue;
2929
                $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...
2930
                //Unidade
2931
                $x     += $w5;
2932
                $texto = $uCom;
2933
                $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...
2934
                //Unidade de medida tributável
2935
                $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...
2936
                if ($mostrarUnidadeTributavel) {
2937
                    $texto = $uTrib->nodeValue;
2938
                    $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...
2939
                }
2940
                $x += $w6;
2941
                if ($this->orientacao == 'P') {
2942
                    $alinhamento = 'R';
2943
                } else {
2944
                    $alinhamento = 'R';
2945
                }
2946
                // QTDADE
2947
                $qCom  = $prod->getElementsByTagName("qCom")->item(0);
2948
                $texto = number_format($qCom->nodeValue, $this->qComCasasDec, ",", ".");
2949
                $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...
2950
                // QTDADE Tributável
2951
                if ($mostrarUnidadeTributavel) {
2952
                    $qTrib = $prod->getElementsByTagName("qTrib")->item(0);
2953
                    if (! empty($qTrib)) {
2954
                        $texto = number_format($qTrib->nodeValue, $this->qComCasasDec, ",", ".");
2955
                        $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...
2956
                    }
2957
                }
2958
                $x += $w7;
2959
                // Valor Unitário
2960
                $vUnCom = $prod->getElementsByTagName("vUnCom")->item(0);
2961
                $texto  = number_format($vUnCom->nodeValue, $this->vUnComCasasDec, ",", ".");
2962
                $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...
2963
                // Valor Unitário Tributável
2964
                if ($mostrarUnidadeTributavel) {
2965
                    $vUnTrib = $prod->getElementsByTagName("vUnTrib")->item(0);
2966
                    if (! empty($vUnTrib)) {
2967
                        $texto = number_format($vUnTrib->nodeValue, $this->vUnComCasasDec, ",", ".");
2968
                        $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...
2969
                    }
2970
                }
2971
                $x += $w8;
2972
                // Valor do Produto
2973
                $texto = "";
2974
                if (is_numeric($prod->getElementsByTagName("vProd")->item(0)->nodeValue)) {
2975
                    $texto = number_format($prod->getElementsByTagName("vProd")->item(0)->nodeValue, 2, ",", ".");
2976
                }
2977
                $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...
2978
                $x += $w9;
2979
                //Valor do Desconto
2980
                $vdesc = ! empty($prod->getElementsByTagName("vDesc")->item(0)->nodeValue)
2981
                    ? $prod->getElementsByTagName("vDesc")->item(0)->nodeValue : 0;
2982
2983
                $texto = number_format($vdesc, 2, ",", ".");
2984
                $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...
2985
                //Valor da Base de calculo
2986
                $x += $w10;
2987
                if (isset($ICMS)) {
2988
                    $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue)
2989
                        ? number_format(
2990
                            $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue,
2991
                            2,
2992
                            ",",
2993
                            "."
2994
                        )
2995
                        : '0,00';
2996
                    $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...
2997
                }
2998
                //Valor do ICMS
2999
                $x += $w11;
3000
                if (isset($ICMS)) {
3001
                    $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue)
3002
                        ? number_format(
3003
                            $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue,
3004
                            2,
3005
                            ",",
3006
                            "."
3007
                        )
3008
                        : '0,00';
3009
                    $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...
3010
                }
3011
                //Valor do IPI
3012
                $x += $w12;
3013
                if (isset($IPI)) {
3014
                    $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue)
3015
                        ? number_format(
3016
                            $IPI->getElementsByTagName("vIPI")->item(0)->nodeValue,
3017
                            2,
3018
                            ",",
3019
                            "."
3020
                        )
3021
                        : '';
3022
                } else {
3023
                    $texto = '';
3024
                }
3025
                $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...
3026
                // %ICMS
3027
                $x += $w13;
3028
                if (isset($ICMS)) {
3029
                    $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue)
3030
                        ? number_format(
3031
                            $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue,
3032
                            2,
3033
                            ",",
3034
                            "."
3035
                        )
3036
                        : '0,00';
3037
                    $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...
3038
                }
3039
                //%IPI
3040
                $x += $w14;
3041
                if (isset($IPI)) {
3042
                    $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue)
3043
                        ? number_format(
3044
                            $IPI->getElementsByTagName("pIPI")->item(0)->nodeValue,
3045
                            2,
3046
                            ",",
3047
                            "."
3048
                        )
3049
                        : '';
3050
                } else {
3051
                    $texto = '';
3052
                }
3053
                $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...
3054
3055
3056
                // Dados do Veiculo Somente para veiculo 0 Km
3057
                $veicProd = $prod->getElementsByTagName("veicProd")->item(0);
3058
                // Tag somente é gerada para veiculo 0k, e só é permitido um veiculo por NF-e por conta do detran
3059
                // Verifica se a Tag existe
3060
                if (! empty($veicProd)) {
3061
                    $this->dadosItenVeiculoDANFE($oldX, $y, $nInicio, $h, $prod);
3062
                }
3063
3064
3065
                $y += $h;
3066
                $i ++;
3067
                //incrementa o controle dos itens processados.
3068
                $this->qtdeItensProc ++;
3069
            } else {
3070
                $i ++;
3071
            }
3072
        }
3073
3074
        return $oldY + $hmax;
3075
    }
3076
3077
3078
    /**
3079
     * dadosItenVeiculoDANFE
3080
     * Coloca os dados do veiculo abaixo do item da NFe. (retrato e paisagem)
3081
     *
3082
     * @param float  $x    Posição horizontal
3083
     *                     canto esquerdo
3084
     * @param float  $y    Posição vertical
3085
     *                     canto superior
3086
     * @param        $nInicio
3087
     * @param float  $h    altura do campo
3088
     * @param object $prod Contendo todos os dados do item
3089
     */
3090
3091
    protected function dadosItenVeiculoDANFE($x, $y, &$nInicio, $h, $prod)
3092
    {
3093
        $oldX = $x;
3094
        $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...
3095
3096
        if ($this->orientacao == 'P') {
3097
            $w = $this->wPrint;
3098
        } else {
3099
            if ($nInicio < 2) { // primeira página
3100
                $w = $this->wPrint - $this->wCanhoto;
3101
            } else { // páginas seguintes
3102
                $w = $this->wPrint;
3103
            }
3104
        }
3105
3106
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
3107
3108
        $w1 = round($w * 0.09, 0);
3109
3110
        // Tabela Renavam Combustivel
3111
        $renavamCombustivel = [
3112
            1  => 'ALCOOL',
3113
            2  => 'GASOLINA',
3114
            3  => 'DIESEL',
3115
            4  => 'GASOGENIO',
3116
            5  => 'GAS METANO',
3117
            6  => 'ELETRICO/FONTE INTERNA',
3118
            7  => 'ELETRICO/FONTE EXTERNA',
3119
            8  => 'GASOL/GAS NATURAL COMBUSTIVEL',
3120
            9  => 'ALCOOL/GAS NATURAL COMBUSTIVEL',
3121
            10 => 'DIESEL/GAS NATURAL COMBUSTIVEL',
3122
            11 => 'VIDE/CAMPO/OBSERVACAO',
3123
            12 => 'ALCOOL/GAS NATURAL VEICULAR',
3124
            13 => 'GASOLINA/GAS NATURAL VEICULAR',
3125
            14 => 'DIESEL/GAS NATURAL VEICULAR',
3126
            15 => 'GAS NATURAL VEICULAR',
3127
            16 => 'ALCOOL/GASOLINA',
3128
            17 => 'GASOLINA/ALCOOL/GAS NATURAL',
3129
            18 => 'GASOLINA/ELETRICO'
3130
        ];
3131
3132
        $renavamEspecie = [
3133
            1 => 'PASSAGEIRO',
3134
            2 => 'CARGA',
3135
            3 => 'MISTO',
3136
            4 => 'CORRIDA',
3137
            5 => 'TRACAO',
3138
            6 => 'ESPECIAL',
3139
            7 => 'COLECAO'
3140
        ];
3141
3142
        $renavamTiposVeiculos = [
3143
            1  => 'BICICLETA',
3144
            2  => 'CICLOMOTOR',
3145
            3  => 'MOTONETA',
3146
            4  => 'MOTOCICLETA',
3147
            5  => 'TRICICLO',
3148
            6  => 'AUTOMOVEL',
3149
            7  => 'MICROONIBUS',
3150
            8  => 'ONIBUS',
3151
            9  => 'BONDE',
3152
            10 => 'REBOQUE',
3153
            11 => 'SEMI-REBOQUE',
3154
            12 => 'CHARRETE',
3155
            13 => 'CAMIONETA',
3156
            14 => 'CAMINHAO',
3157
            15 => 'CARROCA',
3158
            16 => 'CARRO DE MAO',
3159
            17 => 'CAMINHAO TRATOR',
3160
            18 => 'TRATOR DE RODAS',
3161
            19 => 'TRATOR DE ESTEIRAS',
3162
            20 => 'TRATOR MISTO',
3163
            21 => 'QUADRICICLO',
3164
            22 => 'CHASSI/PLATAFORMA',
3165
            23 => 'CAMINHONETE',
3166
            24 => 'SIDE-CAR',
3167
            25 => 'UTILITARIO',
3168
            26 => 'MOTOR-CASA'
3169
        ];
3170
3171
        $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...
3172
            'F' => 'FOSCA',
3173
            'S' => 'SÓLIDA',
3174
            'P' => 'PEROLIZADA',
3175
            'M' => 'METALICA',
3176
        ];
3177
3178
        $veicProd = $prod->getElementsByTagName("veicProd")->item(0);
3179
3180
        $veiculoChassi     = $veicProd->getElementsByTagName("chassi")->item(0)->nodeValue;
3181
        $veiculoCor        = $veicProd->getElementsByTagName("xCor")->item(0)->nodeValue;
3182
        $veiculoCilindrada = $veicProd->getElementsByTagName("cilin")->item(0)->nodeValue;
3183
        $veiculoCmkg       = $veicProd->getElementsByTagName("CMT")->item(0)->nodeValue;
3184
        $veiculoTipo       = $veicProd->getElementsByTagName("tpVeic")->item(0)->nodeValue;
3185
3186
        $veiculoMotor       = $veicProd->getElementsByTagName("nMotor")->item(0)->nodeValue;
3187
        $veiculoRenavam     = $veicProd->getElementsByTagName("cMod")->item(0)->nodeValue;
3188
        $veiculoHp          = $veicProd->getElementsByTagName("pot")->item(0)->nodeValue;
3189
        $veiculoPlaca       = ''; //$veiculo->getElementsByTagName("CMT")->item(0)->nodeValue;
3190
        $veiculoTipoPintura = $veicProd->getElementsByTagName("tpPint")->item(0)->nodeValue;
3191
        $veiculoMarcaModelo = $prod->getElementsByTagName("xProd")->item(0)->nodeValue;
3192
        $veiculoEspecie     = $veicProd->getElementsByTagName("espVeic")->item(0)->nodeValue;
3193
        $veiculoCombustivel = $veicProd->getElementsByTagName("tpComb")->item(0)->nodeValue;
3194
        $veiculoSerial      = $veicProd->getElementsByTagName("nSerie")->item(0)->nodeValue;
3195
        $veiculoFabricacao  = $veicProd->getElementsByTagName("anoFab")->item(0)->nodeValue;
3196
        $veiculoModelo      = $veicProd->getElementsByTagName("anoMod")->item(0)->nodeValue;
3197
        $veiculoDistancia   = $veicProd->getElementsByTagName("dist")->item(0)->nodeValue;
3198
3199
        $x = $oldX;
3200
3201
        $yVeic = $y + $h;
3202
        $texto = 'Chassi: ............: ' . $veiculoChassi;
3203
        $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...
3204
        $yVeic += $h;
3205
        $texto = 'Cor...................: ' . $veiculoCor;
3206
        $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...
3207
        $yVeic += $h;
3208
        $texto = 'Cilindrada........: ' . $veiculoCilindrada;
3209
        $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...
3210
        $yVeic += $h;
3211
        $texto = 'Cmkg...............: ' . $veiculoCmkg;
3212
        $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...
3213
        $yVeic += $h;
3214
        $texto = 'Tipo.................: ' . ($renavamTiposVeiculos[intval($veiculoTipo)] ?? $veiculoTipo);
3215
        $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...
3216
        $yVeic = $y + $h;
3217
        $xVeic = $x + 65;
3218
        $texto = 'Nº Motor: .........: ' . $veiculoMotor;
3219
        $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...
3220
        $yVeic += $h;
3221
        $texto = 'Renavam...........: ' . $veiculoRenavam;
3222
        $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...
3223
        $yVeic += $h;
3224
        $texto = 'HP.....................: ' . $veiculoHp;
3225
        $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...
3226
        $yVeic += $h;
3227
        $texto = 'Placa.................: ' . $veiculoPlaca;
3228
        $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...
3229
        $yVeic += $h;
3230
        $texto = 'Tipo Pintura......: ' . ($renavamEspecie[intval($veiculoTipoPintura)] ?? $veiculoTipoPintura);
3231
        $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...
3232
        $yVeic = $y + $h;
3233
        $xVeic = $xVeic + 55;
3234
        $texto = 'Marca / Modelo.....: ' . $veiculoMarcaModelo;
3235
        $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...
3236
        $yVeic += $h;
3237
        $texto = 'Especie..................: ' . ($renavamEspecie[intval($veiculoEspecie)] ?? $veiculoEspecie);
3238
        $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...
3239
        $yVeic += $h;
3240
        $texto = 'Combustivel..........: ' . ($renavamCombustivel[intval($veiculoCombustivel)] ?? $veiculoCombustivel);
3241
        $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...
3242
        $yVeic += $h;
3243
        $texto = 'Serial.....................: ' . $veiculoSerial;
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 = 'Ano Fab/Mod........: ' . $veiculoFabricacao . '/' . $veiculoModelo;
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 = 'Distancia Entre Eixos(mm)..: ' . $veiculoDistancia;
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
    }
3252
3253
    /**
3254
     * issqn
3255
     * Monta o campo de serviços do DANFE
3256
     *
3257
     * @name   issqn (retrato e paisagem)
3258
     *
3259
     * @param float $x Posição horizontal canto esquerdo
3260
     * @param float $y Posição vertical canto superior
3261
     *
3262
     * @return float Posição vertical final
3263
     */
3264
    protected function issqn($x, $y)
3265
    {
3266
        $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...
3267
        //#####################################################################
3268
        //CÁLCULO DO ISSQN
3269
        $texto = "CÁLCULO DO ISSQN";
3270
        $w     = $this->wPrint;
3271
        $h     = 7;
3272
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
3273
        $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...
3274
        //INSCRIÇÃO MUNICIPAL
3275
        $y     += 3;
3276
        $w     = round($this->wPrint * 0.23, 0);
3277
        $texto = 'INSCRIÇÃO MUNICIPAL';
3278
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3279
        $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...
3280
        //inscrição municipal
3281
        $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
3282
            $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : '';
3283
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
3284
        $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...
3285
        //VALOR TOTAL DOS SERVIÇOS
3286
        $x     += $w;
3287
        $texto = 'VALOR TOTAL DOS SERVIÇOS';
3288
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3289
        $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...
3290
        if (isset($this->ISSQNtot)) {
3291
            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
3292
                $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : '';
3293
            $texto = number_format($texto, 2, ",", ".");
3294
        } else {
3295
            $texto = '';
3296
        }
3297
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
3298
        $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...
3299
        //BASE DE CÁLCULO DO ISSQN
3300
        $x     += $w;
3301
        $texto = 'BASE DE CÁLCULO DO ISSQN';
3302
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3303
        $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...
3304
        if (isset($this->ISSQNtot)) {
3305
            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
3306
                $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : '';
3307
            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
3308
        } else {
3309
            $texto = '';
3310
        }
3311
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
3312
        $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...
3313
        //VALOR TOTAL DO ISSQN
3314
        $x += $w;
3315
        if ($this->orientacao == 'P') {
3316
            $w = $this->wPrint - (3 * $w);
3317
        } else {
3318
            $w = $this->wPrint - (3 * $w) - $this->wCanhoto;
3319
        }
3320
        $texto = 'VALOR TOTAL DO ISSQN';
3321
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3322
        $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...
3323
        if (isset($this->ISSQNtot)) {
3324
            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
3325
                $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : '';
3326
            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
3327
        } else {
3328
            $texto = '';
3329
        }
3330
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
3331
        $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...
3332
3333
        return ($y + $h + 1);
3334
    }
3335
3336
    /**
3337
     *dadosAdicionais
3338
     * Coloca o grupo de dados adicionais da NFe. (retrato e paisagem)
3339
     *
3340
     * @name   dadosAdicionais
3341
     *
3342
     * @param float $x Posição horizontal canto esquerdo
3343
     * @param float $y Posição vertical canto superior
3344
     * @param float $h altura do campo
3345
     *
3346
     * @return float Posição vertical final (eixo Y)
3347
     */
3348
    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...
3349
    {
3350
        $y = $this->maxH - (7 + $h);
3351
        //$y = $this->maxH - 20;
3352
        //##################################################################################
3353
        //DADOS ADICIONAIS
3354
        $texto = "DADOS ADICIONAIS";
3355
        if ($this->orientacao == 'P') {
3356
            $w = $this->wPrint;
3357
        } else {
3358
            $w = $this->wPrint - $this->wCanhoto;
3359
        }
3360
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
3361
        $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...
3362
3363
        //INFORMAÇÕES COMPLEMENTARES
3364
        $texto = "INFORMAÇÕES COMPLEMENTARES";
3365
        $y     += 3;
3366
        $w     = $this->wAdic;
3367
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'B'];
3368
        $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...
3369
        //o texto com os dados adicionais foi obtido na função montaDANFE
3370
        //e carregado em uma propriedade privada da classe
3371
        //$this->wAdic com a largura do campo
3372
        //$this->textoAdic com o texto completo do campo
3373
        //echo str_replace("\n", "<br>",$this->textoAdic);
3374
        //die;
3375
        $y     += 1;
3376
        $aFont = ['font' => $this->fontePadrao, 'size' => $this->textadicfontsize * $this->pdf->k, 'style' => ''];
3377
        //$aFont = ['font'=>$this->fontePadrao, 'size'=> 5, 'style'=>''];
3378
        $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...
3379
        //RESERVADO AO FISCO
3380
        $texto = "RESERVADO AO FISCO";
3381
        if (isset($this->nfeProc) && $this->nfeProc->getElementsByTagName("xMsg")->length) {
3382
            $texto = $texto . ' ' . $this->nfeProc->getElementsByTagName("xMsg")->item(0)->nodeValue;
3383
        }
3384
        $x += $w;
3385
        $y -= 1;
3386
        if ($this->orientacao == 'P') {
3387
            $w = $this->wPrint - $w;
3388
        } else {
3389
            $w = $this->wPrint - $w - $this->wCanhoto;
3390
        }
3391
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'B'];
3392
        $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...
3393
        //inserir texto informando caso de contingência
3394
        // 1 - Normal - emissão normal;
3395
        // 2 - Contingência FS - emissão em contingência com impressão do DANFE em Formulário de Segurança;
3396
        // 3 - Contingência SCAN - emissão em contingência no Sistema de Contingência do Ambiente Nacional;
3397
        // 4 - Contingência EPEC - emissão em contingência com envio da Evento
3398
        //     Prévia de Emissão em Contingência;
3399
        // 5 - Contingência FS-DA - emissão em contingência com impressão do DANFE em Formulário de
3400
        //     Segurança para Impressão de Documento Auxiliar de Documento Fiscal Eletrônico (FS-DA);
3401
        // 6 - Contingência SVC-AN
3402
        // 7 - Contingência SVC-RS
3403
        $xJust  = $this->getTagValue($this->ide, 'xJust', 'Justificativa: ');
3404
        $dhCont = $this->getTagValue($this->ide, 'dhCont', ' Entrada em contingência : ');
3405
        $texto  = '';
3406
        switch ($this->tpEmis) {
3407
            case 4:
3408
                $texto = "CONTINGÊNCIA EPEC\n" . $dhCont . "\n" . $xJust;
3409
                break;
3410
            case 5:
3411
                $texto = "CONTINGÊNCIA FSDA\n" . $dhCont . "\n" . $xJust;
3412
                break;
3413
            case 6:
3414
                $texto = "CONTINGÊNCIA SVC-AN\n" . $dhCont . "\n" . $xJust;
3415
                break;
3416
            case 7:
3417
                $texto = "CONTINGÊNCIA SVC-RS\n" . $dhCont . "\n" . $xJust;
3418
                break;
3419
        }
3420
        $y     += 2;
3421
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
3422
        $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...
3423
3424
        return $y + $h;
3425
    }
3426
3427
    /**
3428
     * rodape
3429
     * Monta o rodapé no final da DANFE com a data/hora de impressão e informações
3430
     * sobre a API NfePHP
3431
     *
3432
     * @param float $x Posição horizontal canto esquerdo
3433
     *
3434
     * @return void
3435
     */
3436
    protected function rodape($x)
3437
    {
3438
        $y = $this->maxH - 4;
3439
        if ($this->orientacao == 'P') {
3440
            $w = $this->wPrint;
3441
        } else {
3442
            $w = $this->wPrint - $this->wCanhoto;
3443
            $x = $this->wCanhoto;
3444
        }
3445
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I'];
3446
        $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s')
3447
            . '  ' . $this->creditos;
3448
        $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false);
3449
        $texto = $this->powered ? "Powered by NFePHP®" : '';
3450
        $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'R', false, '');
3451
    }
3452
3453
    /**
3454
     * Monta o canhoto da DANFE (retrato e paisagem)
3455
     *
3456
     * @name   canhotoDANFE
3457
     *
3458
     * @param number $x Posição horizontal canto esquerdo
3459
     * @param number $y Posição vertical canto superior
3460
     *
3461
     * @return number Posição vertical final
3462
     *
3463
     * TODO 21/07/14 fmertins: quando orientação L-paisagem, o canhoto está sendo gerado incorretamente
3464
     */
3465
    protected function canhoto($x, $y)
3466
    {
3467
        $oldX = $x;
3468
        $oldY = $y;
3469
        //#################################################################################
3470
        //canhoto
3471
        //identificação do tipo de nf entrada ou saida
3472
        $tpNF = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
3473
        if ($tpNF == '0') {
3474
            //NFe de Entrada
3475
            $emitente     = '';
3476
            $emitente     .= $this->dest->getElementsByTagName("xNome")->item(0)->nodeValue . " - ";
3477
            $emitente     .= $this->enderDest->getElementsByTagName("xLgr")->item(0)->nodeValue . ", ";
3478
            $emitente     .= $this->enderDest->getElementsByTagName("nro")->item(0)->nodeValue . " - ";
3479
            $emitente     .= $this->getTagValue($this->enderDest, "xCpl", " - ", " ");
3480
            $emitente     .= $this->enderDest->getElementsByTagName("xBairro")->item(0)->nodeValue . " ";
3481
            $emitente     .= $this->enderDest->getElementsByTagName("xMun")->item(0)->nodeValue . "-";
3482
            $emitente     .= $this->enderDest->getElementsByTagName("UF")->item(0)->nodeValue . "";
3483
            $destinatario = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue . " ";
3484
        } else {
3485
            //NFe de Saída
3486
            $emitente     = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue . " ";
3487
            $destinatario = '';
3488
            $destinatario .= $this->dest->getElementsByTagName("xNome")->item(0)->nodeValue . " - ";
3489
            $destinatario .= $this->enderDest->getElementsByTagName("xLgr")->item(0)->nodeValue . ", ";
3490
            $destinatario .= $this->enderDest->getElementsByTagName("nro")->item(0)->nodeValue . " ";
3491
            $destinatario .= $this->getTagValue($this->enderDest, "xCpl", " - ", " ");
3492
            $destinatario .= $this->enderDest->getElementsByTagName("xBairro")->item(0)->nodeValue . " ";
3493
            $destinatario .= $this->enderDest->getElementsByTagName("xMun")->item(0)->nodeValue . "-";
3494
            $destinatario .= $this->enderDest->getElementsByTagName("UF")->item(0)->nodeValue . " ";
3495
        }
3496
        //identificação do sistema emissor
3497
        //linha separadora do canhoto
3498
        if ($this->orientacao == 'P') {
3499
            $w = round($this->wPrint * 0.81, 0);
3500
        } else {
3501
            //linha separadora do canhoto - 238
3502
            //posicao altura
3503
            $y = $this->wPrint - 85;
3504
            //altura
3505
            $w = $this->wPrint - 85 - 24;
3506
        }
3507
        $h = 10;
3508
        //desenha caixa
3509
        $texto      = '';
3510
        $aFont      = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
3511
        $aFontSmall = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3512
        if ($this->orientacao == 'P') {
3513
            $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...
3514
        } else {
3515
            $this->pdf->textBox90($x, $y, $w, $h, $texto, $aFont, 'C', 'L', 1, '', false);
3516
        }
3517
        $numNF = str_pad($this->ide->getElementsByTagName('nNF')->item(0)->nodeValue, 9, "0", STR_PAD_LEFT);
3518
        $serie = str_pad($this->ide->getElementsByTagName('serie')->item(0)->nodeValue, 3, "0", STR_PAD_LEFT);
3519
        $texto = "RECEBEMOS DE ";
3520
        $texto .= $emitente;
3521
        $texto .= " OS PRODUTOS E/OU SERVIÇOS CONSTANTES DA NOTA FISCAL ELETRÔNICA INDICADA ";
3522
        if ($this->orientacao == 'P') {
3523
            $texto .= "ABAIXO";
3524
        } else {
3525
            $texto .= "AO LADO";
3526
        }
3527
        $texto .= ". EMISSÃO: ";
3528
        $dEmi  = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3529
            $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3530
        if ($dEmi == '') {
3531
            $dEmi  = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3532
                $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3533
            $aDemi = explode('T', $dEmi);
3534
            $dEmi  = $aDemi[0];
3535
        }
3536
        $texto .= $this->ymdTodmy($dEmi) . " ";
3537
        $texto .= "VALOR TOTAL: R$ ";
3538
        $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " ";
3539
        $texto .= "DESTINATÁRIO: ";
3540
        $texto .= $destinatario;
3541
        if ($this->orientacao == 'P') {
3542
            $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...
3543
            $x1    = $x + $w;
3544
            $w1    = $this->wPrint - $w;
3545
            $texto = "NF-e";
3546
            $aFont = ['font' => $this->fontePadrao, 'size' => 14, 'style' => 'B'];
3547
            $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...
3548
            $texto = "Nº. " . $this->formatField($numNF, "###.###.###") . " \n";
3549
            $texto .= "Série $serie";
3550
            $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
3551
            $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...
3552
            //DATA DE RECEBIMENTO
3553
            $texto = "DATA DE RECEBIMENTO";
3554
            $y     += $h;
3555
            $w2    = round($this->wPrint * 0.17, 0); //35;
3556
            $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3557
            $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...
3558
            //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3559
            $x     += $w2;
3560
            $w3    = $w - $w2;
3561
            $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3562
            $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...
3563
            $x = $oldX;
3564
            $y += 9;
3565
            $this->pdf->dashedHLine($x, $y, $this->wPrint, 0.1, 80);
3566
            $y += 2;
3567
3568
            return $y;
3569
        } else {
3570
            $x --;
3571
            $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...
3572
            //NUMERO DA NOTA FISCAL LOGO NFE
3573
            $w1    = 18;
3574
            $x1    = $oldX;
3575
            $y     = $oldY;
3576
            $texto = "NF-e";
3577
            $aFont = ['font' => $this->fontePadrao, 'size' => 14, 'style' => 'B'];
3578
            $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...
3579
            $texto = "Nº.\n" . $this->formatField($numNF, "###.###.###") . " \n";
3580
            $texto .= "Série $serie";
3581
            $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
3582
            $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...
3583
            //DATA DO RECEBIMENTO
3584
            $texto = "DATA DO RECEBIMENTO";
3585
            $y     = $this->wPrint - 85;
3586
            $x     = 12;
3587
            $w2    = round($this->wPrint * 0.17, 0); //35;
3588
            $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3589
            $this->pdf->textBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3590
            //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3591
            $y     -= $w2;
3592
            $w3    = $w - $w2;
3593
            $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3594
            $aFont = ['font' => $this->fontePadrao, 'size' => 5.7, 'style' => ''];
3595
            $x     = $this->pdf->textBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3596
            $this->pdf->dashedVLine(22, $oldY, 0.1, $this->wPrint, 69);
3597
3598
            return $x;
3599
        }
3600
    }
3601
3602
    /**
3603
     * geraInformacoesDaTagCompra
3604
     * Devolve uma string contendo informação sobre as tag <compra><xNEmp>, <xPed> e <xCont> ou string vazia.
3605
     * Aviso: Esta função não leva em consideração dados na tag xPed do item.
3606
     *
3607
     * @name   pGeraInformacoesDaTagCompra
3608
     * @return string com as informacoes dos pedidos.
3609
     */
3610
    protected function geraInformacoesDaTagCompra()
3611
    {
3612
        if (! $this->gerarInformacoesAutomaticas) {
3613
            return '';
3614
        }
3615
        $saida = "";
3616
        if (isset($this->compra)) {
3617
            if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3618
                $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue;
3619
            }
3620
            if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3621
                $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue;
3622
            }
3623
            if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3624
                $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue;
3625
            }
3626
        }
3627
3628
        return $saida;
3629
    }
3630
3631
    /**
3632
     * geraChaveAdicionalDeContingencia
3633
     *
3634
     * @name   geraChaveAdicionalDeContingencia
3635
     * @return string chave
3636
     */
3637
    protected function geraChaveAdicionalDeContingencia()
3638
    {
3639
        //cUF tpEmis CNPJ vNF ICMSp ICMSs DD  DV
3640
        // Quantidade de caracteres  02   01      14  14    01    01  02 01
3641
        $forma = "%02d%d%s%014d%01d%01d%02d";
3642
        $cUF   = $this->ide->getElementsByTagName('cUF')->item(0)->nodeValue;
3643
        $CNPJ  = "00000000000000" . $this->emit->getElementsByTagName('CNPJ')->item(0)->nodeValue;
3644
        $CNPJ  = substr($CNPJ, - 14);
3645
        $vNF   = $this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue * 100;
3646
        $vICMS = $this->ICMSTot->getElementsByTagName("vICMS")->item(0)->nodeValue;
3647
        if ($vICMS > 0) {
3648
            $vICMS = 1;
3649
        }
3650
        $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3651
        if ($icmss > 0) {
3652
            $icmss = 1;
3653
        }
3654
        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3655
            $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3656
        if ($dEmi == '') {
3657
            $dEmi  = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3658
                $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3659
            $aDemi = explode('T', $dEmi);
3660
            $dEmi  = $aDemi[0];
3661
        }
3662
        $dd    = $dEmi;
3663
        $rpos  = strrpos($dd, '-');
3664
        $dd    = substr($dd, $rpos + 1);
3665
        $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd);
3666
        $chave = $chave . $this->modulo11($chave);
3667
3668
        return $chave;
3669
    }
3670
3671
    /**
3672
     *  geraInformacoesDasNotasReferenciadas
3673
     * Devolve uma string contendo informação sobre as notas referenciadas. Suporta N notas, eletrônicas ou não
3674
     * Exemplo: NFe Ref.: série: 01 número: 01 emit: 11.111.111/0001-01
3675
     * em 10/2010 [0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000]
3676
     *
3677
     * @return string Informacoes a serem adicionadas no rodapé sobre notas referenciadas.
3678
     */
3679
    protected function geraInformacoesDasNotasReferenciadas()
3680
    {
3681
        if (! $this->gerarInformacoesAutomaticas) {
3682
            return '';
3683
        }
3684
        $formaNfeRef = "\r\nNFe Ref.: série:%d número:%d emit:%s em %s [%s]";
3685
        $formaCTeRef = "\r\nCTe Ref.: série:%d número:%d emit:%s em %s [%s]";
3686
        $formaNfRef  = "\r\nNF  Ref.: série:%d numero:%d emit:%s em %s modelo: %d";
3687
        $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d";
3688
        $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s";
3689
        $saida       = '';
3690
        $nfRefs      = $this->ide->getElementsByTagName('NFref');
3691
        if (0 === $nfRefs->length) {
3692
            return $saida;
3693
        }
3694
        if ($nfRefs->length > 2) {
3695
            return 'Existem mais de 2 NF/NFe/ECF/NFP/CTe referenciadas, não serão exibidas na DANFE.';
3696
        }
3697
        foreach ($nfRefs as $nfRef) {
3698
            if (empty($nfRef)) {
3699
                continue;
3700
            }
3701
            $refNFe = $nfRef->getElementsByTagName('refNFe');
3702
            foreach ($refNFe as $chave_acessoRef) {
3703
                $chave_acesso  = $chave_acessoRef->nodeValue;
3704
                $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3705
                $data          = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3706
                $cnpj          = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3707
                $serie         = substr($chave_acesso, 22, 3);
3708
                $numero        = substr($chave_acesso, 25, 9);
3709
                $saida         .= sprintf($formaNfeRef, $serie, $numero, $cnpj, $data, $chave_acessoF);
3710
            }
3711
            $refNF = $nfRef->getElementsByTagName('refNF');
3712
            foreach ($refNF as $umaRefNFe) {
3713
                $data   = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3714
                $cnpj   = $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue;
3715
                $mod    = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3716
                $serie  = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
3717
                $numero = $umaRefNFe->getElementsByTagName('nNF')->item(0)->nodeValue;
3718
                $data   = substr($data, 2, 2) . "/20" . substr($data, 0, 2);
3719
                $cnpj   = $this->formatField($cnpj, "##.###.###/####-##");
3720
                $saida  .= sprintf($formaNfRef, $serie, $numero, $cnpj, $data, $mod);
3721
            }
3722
            $refCTe = $nfRef->getElementsByTagName('refCTe');
3723
            foreach ($refCTe 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($formaCTeRef, $serie, $numero, $cnpj, $data, $chave_acessoF);
3731
            }
3732
            $refECF = $nfRef->getElementsByTagName('refECF');
3733
            foreach ($refECF as $umaRefNFe) {
3734
                $mod   = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3735
                $nECF  = $umaRefNFe->getElementsByTagName('nECF')->item(0)->nodeValue;
3736
                $nCOO  = $umaRefNFe->getElementsByTagName('nCOO')->item(0)->nodeValue;
3737
                $saida .= sprintf($formaECFRef, $mod, $nECF, $nCOO);
3738
            }
3739
            $refNFP = $nfRef->getElementsByTagName('refNFP');
3740
            foreach ($refNFP as $umaRefNFe) {
3741
                $data   = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3742
                $cnpj   = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3743
                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue :
3744
                    '';
3745
                $cpf    = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3746
                    $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : '';
3747
                $mod    = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3748
                $serie  = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
3749
                $numero = $umaRefNFe->getElementsByTagName('nNF')->item(0)->nodeValue;
3750
                $ie     = $umaRefNFe->getElementsByTagName('IE')->item(0)->nodeValue;
3751
                $data   = substr($data, 2, 2) . "/20" . substr($data, 0, 2);
3752
                if ($cnpj == '') {
3753
                    $cpf_cnpj = $this->formatField($cpf, "###.###.###-##");
3754
                } else {
3755
                    $cpf_cnpj = $this->formatField($cnpj, "##.###.###/####-##");
3756
                }
3757
                $saida .= sprintf($formaNfpRef, $serie, $numero, $cpf_cnpj, $data, $mod, $ie);
3758
            }
3759
        }
3760
3761
        return $saida;
3762
    }
3763
3764
    private function loadDoc($xml)
3765
    {
3766
        $this->xml = $xml;
3767
        if (! empty($xml)) {
3768
            $this->dom = new Dom();
3769
            $this->dom->loadXML($this->xml);
3770
            if (empty($this->dom->getElementsByTagName("infNFe")->item(0))) {
3771
                throw new \Exception('Isso não é um NFe.');
3772
            }
3773
            $this->nfeProc = $this->dom->getElementsByTagName("nfeProc")->item(0);
3774
            $this->infNFe  = $this->dom->getElementsByTagName("infNFe")->item(0);
3775
            $this->ide     = $this->dom->getElementsByTagName("ide")->item(0);
3776
            if ($this->getTagValue($this->ide, "mod") != '55') {
3777
                throw new \Exception("O xml deve ser NF-e modelo 55.");
3778
            }
3779
            $this->entrega    = $this->dom->getElementsByTagName("entrega")->item(0);
3780
            $this->retirada   = $this->dom->getElementsByTagName("retirada")->item(0);
3781
            $this->emit       = $this->dom->getElementsByTagName("emit")->item(0);
3782
            $this->dest       = $this->dom->getElementsByTagName("dest")->item(0);
3783
            $this->enderEmit  = $this->dom->getElementsByTagName("enderEmit")->item(0);
3784
            $this->enderDest  = $this->dom->getElementsByTagName("enderDest")->item(0);
3785
            $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...
3786
            $this->cobr       = $this->dom->getElementsByTagName("cobr")->item(0);
3787
            $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...
3788
            $this->ICMSTot    = $this->dom->getElementsByTagName("ICMSTot")->item(0);
3789
            $this->ISSQNtot   = $this->dom->getElementsByTagName("ISSQNtot")->item(0);
3790
            $this->transp     = $this->dom->getElementsByTagName("transp")->item(0);
3791
            $this->transporta = $this->dom->getElementsByTagName("transporta")->item(0);
3792
            $this->veicTransp = $this->dom->getElementsByTagName("veicTransp")->item(0);
3793
            $this->detPag     = $this->dom->getElementsByTagName("detPag");
3794
            $this->reboque    = $this->dom->getElementsByTagName("reboque")->item(0);
3795
            $this->infAdic    = $this->dom->getElementsByTagName("infAdic")->item(0);
3796
            $this->compra     = $this->dom->getElementsByTagName("compra")->item(0);
3797
            $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...
3798
            $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...
3799
            $this->infProt    = $this->dom->getElementsByTagName("infProt")->item(0);
3800
        }
3801
    }
3802
3803
    /**
3804
     * @param $item
3805
     *
3806
     * @return float
3807
     */
3808
    protected function calculeHeight($item, $mostrarUnidadeTributavel = false)
3809
    {
3810
        if ($this->orientacao == 'P') {
3811
            $w = $this->wPrint;
3812
        } else {
3813
            $w = $this->wPrint - $this->wCanhoto;
3814
        }
3815
        $w2           = round($w * 0.25, 0);
3816
        $aFont        = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
3817
        $textoProduto = $this->descricaoProduto($item);
3818
        $numlinhas    = $this->pdf->getNumLines($textoProduto, $w2, $aFont);
3819
3820
        if ($mostrarUnidadeTributavel && $numlinhas == 1) {
3821
            $numlinhas ++;
3822
        }
3823
3824
        return round(($numlinhas * $this->pdf->fontSize) + ($numlinhas * 0.5), 2);
3825
    }
3826
}
3827