Completed
Pull Request — master (#392)
by Eduardo
03:13
created

Danfe::calculeHeight()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 14
ccs 0
cts 13
cp 0
crap 6
rs 9.7998
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
     * Configuração para determinar se irá exibir ou não informações
273
     * das unidades de medidas tributáveis.
274
     *
275
     * @var boolean
276
     */
277
    protected $mostrarUnidadeTributavel = false;
278
    /**
279
     * @var int
280
     */
281
    protected $hdadosadic = 10;
282
283
    /**
284
     * __construct
285
     *
286
     * @name  __construct
287
     *
288
     * @param string $xml Conteúdo XML da NF-e (com ou sem a tag nfeProc)
289
     */
290
    public function __construct($xml)
291
    {
292
        $this->loadDoc($xml);
293
    }
294
295
296
    /**
297
     * Define se irá mostrar ou não dados as unidades de medidas tributaveis.
298
     *
299
     * @param boolean $mostrarUnidadeTributavel
300
     */
301
    public function setMostrarUnidadeTributavel($mostrarUnidadeTributavel)
302
    {
303
        $this->mostrarUnidadeTributavel = $mostrarUnidadeTributavel;
304
    }
305
306
    /**
307
     * Define a quantidade de casas decimais para unidade comercial.
308
     *
309
     * @param integer $vUnComCasasDec
310
     */
311
    public function setVUnComCasasDec($vUnComCasasDec)
312
    {
313
        $this->vUnComCasasDec = $vUnComCasasDec;
314
    }
315
316
    /**
317
     * Define a quantidade de casas decimais para unidade comercial.
318
     *
319
     * @param integer $qComCasasDec
320
     */
321
    public function setQComCasasDec($qComCasasDec)
322
    {
323
        $this->qComCasasDec = $qComCasasDec;
324
    }
325
326
    protected function calculoEspacoVericalDadosAdicionais()
327
    {
328
        $this->textoAdic = '';
329
        //informações adicionais
330
        $fontProduto            = [
331
            'font'  => $this->fontePadrao,
332
            'size'  => 8,
333
            'style' => ''
334
        ];
335
        $k                      = $this->pdf->k;
336
        $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...
337
        $this->textoAdic        .= $this->geraInformacoesDasNotasReferenciadas();
338
        if (isset($this->infAdic)) {
339
            $i = 0;
340
            if ($this->textoAdic != '') {
341
                $this->textoAdic .= ". \n";
342
            }
343
            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infCpl"))
344
                ? 'Inf. Contribuinte: ' . $this->anfaveaDANFE($this->getTagValue($this->infAdic, "infCpl"))
345
                : '';
346
            $infPedido       = $this->geraInformacoesDaTagCompra();
347
            if ($infPedido != "") {
348
                $this->textoAdic .= $infPedido;
349
            }
350
            $this->textoAdic .= $this->getTagValue($this->dest, "email", ' Email do Destinatário: ');
351
            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infAdFisco"))
352
                ? "\n Inf. fisco: " . $this->getTagValue($this->infAdic, "infAdFisco")
353
                : '';
354
            $obsCont         = $this->infAdic->getElementsByTagName("obsCont");
355
            if (isset($obsCont)) {
356
                foreach ($obsCont as $obs) {
357
                    $campo           = $obsCont->item($i)->getAttribute("xCampo");
358
                    $xTexto          = ! empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue)
359
                        ? $obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue
360
                        : '';
361
                    $this->textoAdic .= "\n" . $campo . ':  ' . trim($xTexto);
362
                    $i ++;
363
                }
364
            }
365
        }
366
        //INCLUSO pela NT 2013.003 Lei da Transparência
367
        //verificar se a informação sobre o valor aproximado dos tributos
368
        //já se encontra no campo de informações adicionais
369
        if ($this->exibirValorTributos) {
370
            $flagVTT  = strpos(strtolower(trim($this->textoAdic)), 'valor');
371
            $flagVTT  = $flagVTT || strpos(strtolower(trim($this->textoAdic)), 'vl');
372
            $flagVTT  = $flagVTT && strpos(strtolower(trim($this->textoAdic)), 'aprox');
373
            $flagVTT  = $flagVTT && (strpos(strtolower(trim($this->textoAdic)), 'trib') ||
374
                    strpos(strtolower(trim($this->textoAdic)), 'imp'));
375
            $vTotTrib = $this->getTagValue($this->ICMSTot, 'vTotTrib');
376
            if ($vTotTrib != '' && ! $flagVTT) {
377
                $this->textoAdic .= "\n Valor Aproximado dos Tributos : R$ "
378
                    . number_format($vTotTrib, 2, ",", ".");
379
            }
380
        }
381
        //fim da alteração NT 2013.003 Lei da Transparência
382
        $this->textoAdic        = str_replace(";", "\n", $this->textoAdic);
383
        $numlinhasdados         = $this->pdf->getNumLines($this->textoAdic, $this->wAdic, $fontProduto) + 1.5;
384
        $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...
385
        $hdadosadic             = ceil($numlinhasdados * ($this->textadicfontsize));
386
        if ($hdadosadic > 70) {
387
            for ($f = 8; $f > 3; $f --) {
388
                $this->pdf->setFont($this->fontePadrao, '', $f);
389
                $fontProduto            = [
390
                    'font'  => $this->fontePadrao,
391
                    'size'  => $f,
392
                    'style' => ''
393
                ];
394
                $numlinhasdados         = $this->pdf->getNumLines($this->textoAdic, $this->wAdic, $fontProduto) + 3;
395
                $this->textadicfontsize = $this->pdf->fontSize;
396
                $hdadosadic             = ceil($numlinhasdados * $this->textadicfontsize);
397
                echo $hdadosadic;
398
                if ($hdadosadic <= 90) {
399
                    $hdadosadic = ceil($hdadosadic);
400
                    break;
401
                }
402
            }
403
        }
404
        if ($hdadosadic < 10) {
405
            $hdadosadic = 10;
406
        }
407
408
        return $hdadosadic;
409
    }
410
411
    protected function calculoItensPorPagina()
412
    {
413
    }
414
415
    /**
416
     * monta
417
     * Monta a DANFE conforme as informações fornecidas para a classe durante sua
418
     * construção. Constroi DANFEs com até 3 páginas podendo conter até 56 itens.
419
     * A definição de margens e posições iniciais para a impressão são estabelecidas
420
     * pelo conteúdo da funçao e podem ser modificados.
421
     *
422
     * @return string O ID da NFe numero de 44 digitos extraido do arquivo XML
423
     */
424
    protected function monta(
425
        $logo = ''
426
    ) {
427
        $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...
428
        $this->logomarca = $this->adjustImage($logo);
429
        //se a orientação estiver em branco utilizar o padrão estabelecido na NF
430
        if (empty($this->orientacao)) {
431
            if ($this->tpImp == '2') {
432
                $this->orientacao = 'L';
433
            } else {
434
                $this->orientacao = 'P';
435
            }
436
        }
437
        //instancia a classe pdf
438
        $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...
439
        //margens do PDF, em milímetros. Obs.: a margem direita é sempre igual à
440
        //margem esquerda. A margem inferior *não* existe na FPDF, é definida aqui
441
        //apenas para controle se necessário ser maior do que a margem superior
442
        // posição inicial do conteúdo, a partir do canto superior esquerdo da página
443
        $xInic = $this->margesq;
444
        if ($this->orientacao == 'P') {
445
            if ($this->papel == 'A4') {
446
                $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...
447
                $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...
448
            }
449
        } else {
450
            if ($this->papel == 'A4') {
451
                $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...
452
                $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...
453
                $xInic      = $this->margesq + 10;
454
                //se paisagem multiplica a largura do canhoto pela quantidade de canhotos
455
                //$this->wCanhoto *= $this->qCanhoto;
456
            }
457
        }
458
        //total inicial de paginas
459
        $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...
460
        //largura imprimivel em mm: largura da folha menos as margens esq/direita
461
        $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...
462
        //comprimento (altura) imprimivel em mm: altura da folha menos as margens
463
        //superior e inferior
464
        $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...
465
        // estabelece contagem de paginas
466
        $this->pdf->aliasNbPages();
467
        // fixa as margens
468
        $this->pdf->setMargins($this->margesq, $this->margsup);
469
        $this->pdf->setDrawColor(0, 0, 0);
470
        $this->pdf->setFillColor(255, 255, 255);
471
        // inicia o documento
472
        $this->pdf->open();
473
        // adiciona a primeira página
474
        $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...
475
        $this->pdf->setLineWidth(0.1);
476
        $this->pdf->settextcolor(0, 0, 0);
477
478
        //##################################################################
479
        // CALCULO DO NUMERO DE PAGINAS A SEREM IMPRESSAS
480
        //##################################################################
481
        //Verificando quantas linhas serão usadas para impressão das duplicatas
482
        $linhasDup = 0;
483
        $qtdPag    = 0;
484
        if (isset($this->dup) && $this->dup->length > 0) {
485
            $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...
486
        } 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...
487
            $qtdPag = $this->detPag->length;
488
        }
489
        if (($qtdPag > 0) && ($qtdPag <= 7)) {
490
            $linhasDup = 1;
491
        } elseif (($qtdPag > 7) && ($qtdPag <= 14)) {
492
            $linhasDup = 2;
493
        } elseif (($qtdPag > 14) && ($qtdPag <= 21)) {
494
            $linhasDup = 3;
495
        } elseif ($qtdPag > 21) {
496
            // chinnonsantos 11/05/2016: Limite máximo de impressão de duplicatas na NFe,
497
            // só vai ser exibito as 21 primeiras duplicatas (parcelas de pagamento),
498
            // se não oculpa espaço d+, cada linha comporta até 7 duplicatas.
499
            $linhasDup = 3;
500
        }
501
        //verifica se será impressa a linha dos serviços ISSQN
502
        $linhaISSQN = 0;
503
        if ((isset($this->ISSQNtot)) && ($this->getTagValue($this->ISSQNtot, 'vServ') > 0)) {
504
            $linhaISSQN = 1;
505
        }
506
        //calcular a altura necessária para os dados adicionais
507
        if ($this->orientacao == 'P') {
508
            $this->wAdic = round($this->wPrint * 0.66, 0);
509
        } else {
510
            $this->wAdic = round(($this->wPrint - $this->wCanhoto) * 0.5, 0);
511
        }
512
        $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...
513
514
        $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...
515
516
        //altura disponivel para os campos da DANFE
517
        $hcabecalho    = 47;//para cabeçalho
518
        $hdestinatario = 25;//para destinatario
519
        $hduplicatas   = 12;//para cada grupo de 7 duplicatas
520
        if (isset($this->entrega)) {
521
            $hlocalentrega = 25;
522
        } else {
523
            $hlocalentrega = 0;
524
        }
525
        if (isset($this->retirada)) {
526
            $hlocalretirada = 25;
527
        } else {
528
            $hlocalretirada = 0;
529
        }
530
        $himposto    = 18;// para imposto
531
        $htransporte = 25;// para transporte
532
        $hissqn      = 11;// para issqn
533
        $hfooter     = 5;// para rodape
534
        $hCabecItens = 4;//cabeçalho dos itens
535
        $hOCUPADA    = $hcabecalho
536
            + $hdestinatario
537
            + $hlocalentrega
538
            + $hlocalretirada
539
            + ($linhasDup * $hduplicatas)
540
            + $himposto + $htransporte
541
            + ($linhaISSQN * $hissqn)
542
            + $this->hdadosadic
543
            + $hfooter
544
            + $hCabecItens
545
            + $this->sizeExtraTextoFatura();
546
547
        //alturas disponiveis para os dados
548
        $hDispo1 = $this->hPrint - $hOCUPADA;
549
550
        /*($hcabecalho +
551
        //$hdestinatario + ($linhasDup * $hduplicatas) + $himposto + $htransporte +
552
        $hdestinatario + $hlocalentrega + $hlocalretirada +
553
        ($linhasDup * $hduplicatas) + $himposto + $htransporte +
554
        ($linhaISSQN * $hissqn) + $this->hdadosadic + $hfooter + $hCabecItens +
555
        $this->sizeExtraTextoFatura());*/
556
557
        if ($this->orientacao == 'P') {
558
            $hDispo1 -= 24 * $this->qCanhoto;//para canhoto
559
            $w       = $this->wPrint;
560
        } else {
561
            $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...
562
            $w        = $this->wPrint - $this->wCanhoto;
563
        }
564
        //$hDispo1 += 14;
565
        $hDispo2 = $this->hPrint - ($hcabecalho + $hfooter + $hCabecItens);
566
        //Contagem da altura ocupada para impressão dos itens
567
        $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...
568
        $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...
569
        $hUsado    = $hCabecItens;
570
        $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...
571
        $hDispo    = $hDispo1;
572
        $totPag    = 1;
573
        $i         = 0;
574
        while ($i < $this->det->length) {
575
            $hUsado += $this->calculeHeight($this->det->item($i));
576
            if ($hUsado > $hDispo) {
577
                $totPag ++;
578
                $hDispo = $hDispo2;
579
                $hUsado = $hCabecItens;
580
                $i --; // decrementa para readicionar o item que não coube nessa pagina na outra.
581
            }
582
            $i ++;
583
        } //fim da soma das areas de itens usadas
584
        $qtdeItens = $i; //controle da quantidade de itens no DANFE
585
        //montagem da primeira página
586
        $pag = 1;
587
588
        $x = $this->margesq;
589
        $y = $this->margsup;
590
        //coloca o(s) canhoto(s) da NFe
591
        if ($this->orientacao == 'P') {
592
            $y = $this->canhoto($this->margesq, $this->margsup);
593
        } else {
594
            $this->canhoto($this->margesq, $this->margsup);
595
            $x = 25;
596
        }
597
        //coloca o cabeçalho
598
        $y = $this->header($x, $y, $pag, $totPag);
599
        //coloca os dados do destinatário
600
        $y = $this->destinatarioDANFE($x, $y + 1);
601
        //coloca os dados do local de retirada
602
        if (isset($this->retirada)) {
603
            $y = $this->localRetiradaDANFE($x, $y + 1);
604
        }
605
        //coloca os dados do local de entrega
606
        if (isset($this->entrega)) {
607
            $y = $this->localEntregaDANFE($x, $y + 1);
608
        }
609
610
        //Verifica as formas de pagamento da nota fiscal
611
        $formaPag = [];
612
        if (isset($this->detPag) && $this->detPag->length > 0) {
613
            foreach ($this->detPag as $k => $d) {
614
                $fPag            = ! empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
615
                    ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue
616
                    : '0';
617
                $formaPag[$fPag] = $fPag;
618
            }
619
        }
620
        //caso tenha boleto imprimir fatura
621
        if ($this->dup->length > 0) {
622
            $y = $this->fatura($x, $y + 1);
623
        } else {
624
            //Se somente tiver a forma de pagamento sem pagamento não imprimir nada
625
            if (count($formaPag) == '1' && isset($formaPag[90])) {
626
                $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...
627
            } else {
628
                //caso tenha mais de uma forma de pagamento ou seja diferente de boleto exibe a
629
                //forma de pagamento e o valor
630
                $y = $this->pagamento($x, $y + 1);
631
            }
632
        }
633
        //coloca os dados dos impostos e totais da NFe
634
        $y = $this->imposto($x, $y + 1);
635
        //coloca os dados do trasnporte
636
        $y = $this->transporte($x, $y + 1);
637
        //itens da DANFE
638
        $nInicial = 0;
639
640
        $y = $this->itens($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
641
642
        //coloca os dados do ISSQN
643
        if ($linhaISSQN == 1) {
644
            $y = $this->issqn($x, $y + 4);
645
        } else {
646
            $y += 4;
647
        }
648
        //coloca os dados adicionais da NFe
649
        $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...
650
        //coloca o rodapé da página
651
        if ($this->orientacao == 'P') {
652
            $this->rodape($xInic);
653
        } else {
654
            $this->rodape($xInic);
655
        }
656
657
        //loop para páginas seguintes
658
        for ($n = 2; $n <= $totPag; $n ++) {
659
            // fixa as margens
660
            $this->pdf->setMargins($this->margesq, $this->margsup);
661
            //adiciona nova página
662
            $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...
663
            //ajusta espessura das linhas
664
            $this->pdf->setLineWidth(0.1);
665
            //seta a cor do texto para petro
666
            $this->pdf->settextcolor(0, 0, 0);
667
            // posição inicial do relatorio
668
            $x = $this->margesq;
669
            $y = $this->margsup;
670
            //coloca o cabeçalho na página adicional
671
            $y = $this->header($x, $y, $n, $totPag);
672
            //coloca os itens na página adicional
673
            $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...
674
            //coloca o rodapé da página
675
            if ($this->orientacao == 'P') {
676
                $this->rodape($this->margesq);
677
            } else {
678
                $this->rodape($this->margesq);
679
            }
680
            //se estiver na última página e ainda restar itens para inserir, adiciona mais uma página
681
            if ($n == $totPag && $this->qtdeItensProc < $qtdeItens) {
682
                $totPag ++;
683
            }
684
        }
685
    }
686
687
    /**
688
     * anfavea
689
     * Função para transformar o campo cdata do padrão ANFAVEA para
690
     * texto imprimível
691
     *
692
     * @param string $cdata campo CDATA
693
     *
694
     * @return string conteúdo do campo CDATA como string
695
     */
696
    protected function anfaveaDANFE($cdata = '')
697
    {
698
        if ($cdata == '') {
699
            return '';
700
        }
701
        //remove qualquer texto antes ou depois da tag CDATA
702
        $cdata    = str_replace('<![CDATA[', '<CDATA>', $cdata);
703
        $cdata    = str_replace(']]>', '</CDATA>', $cdata);
704
        $cdata    = preg_replace('/\s\s+/', ' ', $cdata);
705
        $cdata    = str_replace("> <", "><", $cdata);
706
        $len      = strlen($cdata);
707
        $startPos = strpos($cdata, '<');
708
        if ($startPos === false) {
709
            return $cdata;
710
        }
711
        for ($x = $len; $x > 0; $x --) {
712
            if (substr($cdata, $x, 1) == '>') {
713
                $endPos = $x;
714
                break;
715
            }
716
        }
717
        if ($startPos > 0) {
718
            $parte1 = substr($cdata, 0, $startPos);
719
        } else {
720
            $parte1 = '';
721
        }
722
        $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...
723
        if ($endPos < $len) {
724
            $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
725
        } else {
726
            $parte3 = '';
727
        }
728
        $texto = trim($parte1) . ' ' . trim($parte3);
729
        if (strpos($parte2, '<CDATA>') === false) {
730
            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
731
        } else {
732
            $cdata = $parte2;
733
        }
734
        //Retira a tag <FONTE IBPT> (caso existir) pois não é uma estrutura válida XML
735
        $cdata = str_replace('<FONTE IBPT>', '', $cdata);
736
        //carrega o xml CDATA em um objeto DOM
737
        $dom = new Dom();
738
        $dom->loadXML($cdata, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG);
739
        //$xml = $dom->saveXML();
740
        //grupo CDATA infADprod
741
        $id   = $dom->getElementsByTagName('id')->item(0);
742
        $div  = $dom->getElementsByTagName('div')->item(0);
743
        $entg = $dom->getElementsByTagName('entg')->item(0);
744
        $dest = $dom->getElementsByTagName('dest')->item(0);
745
        $ctl  = $dom->getElementsByTagName('ctl')->item(0);
746
        $ref  = $dom->getElementsByTagName('ref')->item(0);
747
        if (isset($id)) {
748
            if ($id->hasAttributes()) {
749
                foreach ($id->attributes as $attr) {
750
                    $name  = $attr->nodeName;
751
                    $value = $attr->nodeValue;
752
                    $texto .= " $name : $value";
753
                }
754
            }
755
        }
756
        if (isset($div)) {
757
            if ($div->hasAttributes()) {
758
                foreach ($div->attributes as $attr) {
759
                    $name  = $attr->nodeName;
760
                    $value = $attr->nodeValue;
761
                    $texto .= " $name : $value";
762
                }
763
            }
764
        }
765
        if (isset($entg)) {
766
            if ($entg->hasAttributes()) {
767
                foreach ($entg->attributes as $attr) {
768
                    $name  = $attr->nodeName;
769
                    $value = $attr->nodeValue;
770
                    $texto .= " $name : $value";
771
                }
772
            }
773
        }
774
        if (isset($dest)) {
775
            if ($dest->hasAttributes()) {
776
                foreach ($dest->attributes as $attr) {
777
                    $name  = $attr->nodeName;
778
                    $value = $attr->nodeValue;
779
                    $texto .= " $name : $value";
780
                }
781
            }
782
        }
783
        if (isset($ctl)) {
784
            if ($ctl->hasAttributes()) {
785
                foreach ($ctl->attributes as $attr) {
786
                    $name  = $attr->nodeName;
787
                    $value = $attr->nodeValue;
788
                    $texto .= " $name : $value";
789
                }
790
            }
791
        }
792
        if (isset($ref)) {
793
            if ($ref->hasAttributes()) {
794
                foreach ($ref->attributes as $attr) {
795
                    $name  = $attr->nodeName;
796
                    $value = $attr->nodeValue;
797
                    $texto .= " $name : $value";
798
                }
799
            }
800
        }
801
        //grupo CADATA infCpl
802
        $t          = $dom->getElementsByTagName('transmissor')->item(0);
803
        $r          = $dom->getElementsByTagName('receptor')->item(0);
804
        $versao     = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
805
            'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
806
        $especieNF  = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
807
            'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
808
        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
809
            'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
810
        $dca        = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
811
            'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
812
        $texto      .= "" . $versao . $especieNF . $fabEntrega . $dca;
813
        if (isset($t)) {
814
            if ($t->hasAttributes()) {
815
                $texto .= " Transmissor ";
816
                foreach ($t->attributes as $attr) {
817
                    $name  = $attr->nodeName;
818
                    $value = $attr->nodeValue;
819
                    $texto .= " $name : $value";
820
                }
821
            }
822
        }
823
        if (isset($r)) {
824
            if ($r->hasAttributes()) {
825
                $texto .= " Receptor ";
826
                foreach ($r->attributes as $attr) {
827
                    $name  = $attr->nodeName;
828
                    $value = $attr->nodeValue;
829
                    $texto .= " $name : $value";
830
                }
831
            }
832
        }
833
834
        return $texto;
835
    }
836
837
    /**
838
     * Verifica o status da NFe
839
     *
840
     * @return array
841
     */
842
    protected function statusNFe()
843
    {
844
        if (! isset($this->nfeProc)) {
845
            return ['status' => false, 'message' => 'NFe NÃO PROTOCOLADA'];
846
        }
847
        if ($this->getTagValue($this->ide, "tpAmb") == '2') {
848
            return ['status' => false, 'message' => 'NFe EMITIDA EM HOMOLOGAÇÃO'];
849
        }
850
        $cStat = $this->getTagValue($this->nfeProc, "cStat");
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...
851
        if ($cStat == '101'
852
            || $cStat == '151'
853
            || $cStat == '135'
854
            || $cStat == '155'
855
            || $this->cancelFlag === true
856
        ) {
857
            return ['status' => false, 'message' => 'NFe CANCELADA'];
858
        }
859
860
        if ($cStat == '110' ||
861
             $cStat == '301' ||
862
             $cStat == '302'
863
864
        ) {
865
            return ['status' => false, 'message' => 'NFe DENEGADA'];
866
        }
867
868
        return ['status' => true, 'message' => ''];
869
    }
870
871
    protected function notaDPEC()
872
    {
873
        return ! empty($this->numdepec);
874
    }
875
876
    /**
877
     *header
878
     * Monta o cabelhalho da DANFE (retrato e paisagem)
879
     *
880
     * @param number $x      Posição horizontal inicial, canto esquerdo
881
     * @param number $y      Posição vertical inicial, canto superior
882
     * @param number $pag    Número da Página
883
     * @param number $totPag Total de páginas
884
     *
885
     * @return number Posição vertical final
886
     */
887
    protected function header($x = 0, $y = 0, $pag = '1', $totPag = '1')
888
    {
889
        $oldX = $x;
890
        $oldY = $y;
891
        if ($this->orientacao == 'P') {
892
            $maxW = $this->wPrint;
893
        } else {
894
            if ($pag == 1) { // primeira página
895
                $maxW = $this->wPrint - $this->wCanhoto;
896
            } else { // páginas seguintes
897
                $maxW = $this->wPrint;
898
            }
899
        }
900
        //####################################################################################
901
        //coluna esquerda identificação do emitente
902
        $w = round($maxW * 0.41, 0);
903
        if ($this->orientacao == 'P') {
904
            $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I'];
905
        } else {
906
            $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
907
        }
908
        $w1   = $w;
909
        $h    = 32;
910
        $oldY += $h;
911
        $this->pdf->textBox($x, $y, $w, $h);
912
        $texto = 'IDENTIFICAÇÃO DO EMITENTE';
913
        $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...
914
        //estabelecer o alinhamento
915
        //pode ser left L, center C, right R, full logo L
916
        //se for left separar 1/3 da largura para o tamanho da imagem
917
        //os outros 2/3 serão usados para os dados do emitente
918
        //se for center separar 1/2 da altura para o logo e 1/2 para os dados
919
        //se for right separa 2/3 para os dados e o terço seguinte para o logo
920
        //se não houver logo centraliza dos dados do emitente
921
        // coloca o logo
922
        if (! empty($this->logomarca)) {
923
            $logoInfo = getimagesize($this->logomarca);
924
            //largura da imagem em mm
925
            $logoWmm = ($logoInfo[0] / 72) * 25.4;
926
            //altura da imagem em mm
927
            $logoHmm = ($logoInfo[1] / 72) * 25.4;
928
            if ($this->logoAlign == 'L') {
929
                $nImgW = round($w / 3, 0);
930
                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
931
                $xImg  = $x + 1;
932
                $yImg  = round(($h - $nImgH) / 2, 0) + $y;
933
                //estabelecer posições do texto
934
                $x1 = round($xImg + $nImgW + 1, 0);
935
                $y1 = round($h / 3 + $y, 0);
936
                $tw = round(2 * $w / 3, 0);
937
            } elseif ($this->logoAlign == 'C') {
938
                $nImgH = round($h / 3, 0);
939
                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
940
                $xImg  = round(($w - $nImgW) / 2 + $x, 0);
941
                $yImg  = $y + 3;
942
                $x1    = $x;
943
                $y1    = round($yImg + $nImgH + 1, 0);
944
                $tw    = $w;
945
            } elseif ($this->logoAlign == 'R') {
946
                $nImgW = round($w / 3, 0);
947
                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
948
                $xImg  = round($x + ($w - (1 + $nImgW)), 0);
949
                $yImg  = round(($h - $nImgH) / 2, 0) + $y;
950
                $x1    = $x;
951
                $y1    = round($h / 3 + $y, 0);
952
                $tw    = round(2 * $w / 3, 0);
953
            } elseif ($this->logoAlign == 'F') {
954
                $nImgH = round($h - 5, 0);
955
                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
956
                $xImg  = round(($w - $nImgW) / 2 + $x, 0);
957
                $yImg  = $y + 3;
958
                $x1    = $x;
959
                $y1    = round($yImg + $nImgH + 1, 0);
960
                $tw    = $w;
961
            }
962
            $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...
963
            $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg');
0 ignored issues
show
Bug introduced by
The variable $xImg does not seem to be defined for all execution paths leading up to this point.

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

Let’s take a look at an example:

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

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

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

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

Available Fixes

  1. Check for existence of the variable explicitly:

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

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

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
Bug introduced by
The variable $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 $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 $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...
964
        } else {
965
            $x1 = $x;
966
            $y1 = round($h / 3 + $y, 0);
967
            $tw = $w;
968
        }
969
        // monta as informações apenas se diferente de full logo
970
        if ($this->logoAlign !== 'F') {
971
            //Nome emitente
972
            $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B'];
973
            $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
974
            $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...
Bug introduced by
The variable $y1 does not seem to be defined for all execution paths leading up to this point.

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

Let’s take a look at an example:

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

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

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

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

Available Fixes

  1. Check for existence of the variable explicitly:

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

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

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

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

Let’s take a look at an example:

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

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

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

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

Available Fixes

  1. Check for existence of the variable explicitly:

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

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

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

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
975
            //endereço
976
            $y1     = $y1 + 5;
977
            $aFont  = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
978
            $fone   = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
979
                ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
980
                : '';
981
            $lgr    = $this->getTagValue($this->enderEmit, "xLgr");
982
            $nro    = $this->getTagValue($this->enderEmit, "nro");
983
            $cpl    = $this->getTagValue($this->enderEmit, "xCpl", " - ");
984
            $bairro = $this->getTagValue($this->enderEmit, "xBairro");
985
            $CEP    = $this->getTagValue($this->enderEmit, "CEP");
986
            $CEP    = $this->formatField($CEP, "#####-###");
987
            $mun    = $this->getTagValue($this->enderEmit, "xMun");
988
            $UF     = $this->getTagValue($this->enderEmit, "UF");
989
            $texto  = $lgr . ", " . $nro . $cpl . "\n" . $bairro . " - "
990
                . $CEP . "\n" . $mun . " - " . $UF . " "
991
                . "Fone/Fax: " . $fone;
992
            $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...
993
        }
994
995
        //####################################################################################
996
        //coluna central Danfe
997
        $x  += $w;
998
        $w  = round($maxW * 0.17, 0);//35;
999
        $w2 = $w;
1000
        $h  = 32;
1001
        $this->pdf->textBox($x, $y, $w, $h);
1002
1003
        $texto = "DANFE";
1004
        $aFont = ['font' => $this->fontePadrao, 'size' => 14, 'style' => 'B'];
1005
        $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...
1006
        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
1007
        $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
1008
        $h     = 20;
1009
        $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...
1010
1011
        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
1012
        $texto = '0 - ENTRADA';
1013
        $y1    = $y + 14;
1014
        $h     = 8;
1015
        $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...
1016
        $texto = '1 - SAÍDA';
1017
        $y1    = $y + 17;
1018
        $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...
1019
        //tipo de nF
1020
        $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B'];
1021
        $y1    = $y + 13;
1022
        $h     = 7;
1023
        $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
1024
        $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...
1025
        //numero da NF
1026
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1027
        $y1    = $y + 20;
1028
        $numNF = str_pad(
1029
            $this->ide->getElementsByTagName('nNF')->item(0)->nodeValue,
1030
            9,
1031
            "0",
1032
            STR_PAD_LEFT
1033
        );
1034
        $numNF = $this->formatField($numNF, "###.###.###");
1035
        $texto = "Nº. " . $numNF;
1036
        $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...
1037
        //Série
1038
        $y1    = $y + 23;
1039
        $serie = str_pad(
1040
            $this->ide->getElementsByTagName('serie')->item(0)->nodeValue,
1041
            3,
1042
            "0",
1043
            STR_PAD_LEFT
1044
        );
1045
        $texto = "Série " . $serie;
1046
        $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...
1047
        //numero paginas
1048
        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'I'];
1049
        $y1    = $y + 26;
1050
        $texto = "Folha " . $pag . "/" . $totPag;
1051
        $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...
1052
1053
        //####################################################################################
1054
        //coluna codigo de barras
1055
        $x  += $w;
1056
        $w  = ($maxW - $w1 - $w2);//85;
1057
        $w3 = $w;
1058
        $h  = 32;
1059
        $this->pdf->textBox($x, $y, $w, $h);
1060
        $this->pdf->setFillColor(0, 0, 0);
1061
        $chave_acesso = str_replace('NFe', '', $this->infNFe->getAttribute("Id"));
1062
        $bW           = 75;
1063
        $bH           = 12;
1064
        //codigo de barras
1065
        $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
1066
        //linhas divisorias
1067
        $this->pdf->line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH);
1068
        $this->pdf->line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH);
1069
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1070
        $y1    = $y + 4 + $bH;
1071
        $h     = 7;
1072
        $texto = 'CHAVE DE ACESSO';
1073
        $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...
1074
        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
1075
        $y1    = $y + 8 + $bH;
1076
        $texto = $this->formatField($chave_acesso, $this->formatoChave);
1077
        $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...
1078
        $y1                = $y + 12 + $bH;
1079
        $aFont             = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
1080
        $chaveContingencia = "";
1081
        if ($this->notaDpec()) {
1082
            $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC';
1083
        } else {
1084
            $cabecalhoProtoAutorizacao = 'PROTOCOLO DE AUTORIZAÇÃO DE USO';
1085
        }
1086
        if (($this->tpEmis == 2 || $this->tpEmis == 5) && ! $this->notaDpec()) {
1087
            $cabecalhoProtoAutorizacao = "DADOS DA NF-E";
1088
            $chaveContingencia         = $this->geraChaveAdicionalDeContingencia();
1089
            $this->pdf->setFillColor(0, 0, 0);
1090
            //codigo de barras
1091
            $this->pdf->code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2);
1092
        } else {
1093
            $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1094
            $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...
1095
            $y1    = $y + 16 + $bH;
1096
            $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1097
            $this->pdf->textBox(
1098
                $x + 2,
1099
                $y1,
1100
                $w - 2,
1101
                $h,
1102
                $texto,
1103
                $aFont,
1104
                'T',
1105
                'C',
1106
                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...
1107
                'http://www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora'
1108
            );
1109
        }
1110
1111
        //####################################################################################
1112
        //Dados da NF do cabeçalho
1113
        //natureza da operação
1114
        $texto = 'NATUREZA DA OPERAÇÃO';
1115
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1116
        $w     = $w1 + $w2;
1117
        $y     = $oldY;
1118
        $oldY  += $h;
1119
        $x     = $oldX;
1120
        $h     = 7;
1121
        $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...
1122
        $texto = $this->ide->getElementsByTagName("natOp")->item(0)->nodeValue;
1123
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1124
        $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...
1125
        $x += $w;
1126
        $w = $w3;
1127
        //PROTOCOLO DE AUTORIZAÇÃO DE USO ou DADOS da NF-E
1128
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1129
        $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...
1130
        // algumas NFe podem estar sem o protocolo de uso portanto sua existencia deve ser
1131
        // testada antes de tentar obter a informação.
1132
        // NOTA : DANFE sem protocolo deve existir somente no caso de contingência !!!
1133
        // Além disso, existem várias NFes em contingência que eu recebo com protocolo de autorização.
1134
        // Na minha opinião, deveríamos mostra-lo, mas o  manual  da NFe v4.01 diz outra coisa...
1135
        if (($this->tpEmis == 2 || $this->tpEmis == 5) && ! $this->notaDpec()) {
1136
            $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
1137
            $texto = $this->formatField(
1138
                $chaveContingencia,
1139
                "#### #### #### #### #### #### #### #### ####"
1140
            );
1141
            $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...
1142
        } else {
1143
            $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1144
            if ($this->notaDpec()) {
1145
                $texto = $this->numdepec;
1146
                $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...
1147
            } else {
1148
                if (isset($this->nfeProc)) {
1149
                    $texto  = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue)
1150
                        ? $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue
1151
                        : '';
1152
                    $tsHora = $this->toTimestamp(
1153
                        $this->nfeProc->getElementsByTagName("dhRecbto")->item(0)->nodeValue
1154
                    );
1155
                    if ($texto != '') {
1156
                        $texto .= "  -  " . date('d/m/Y H:i:s', $tsHora);
1157
                    }
1158
                    $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...
1159
                } else {
1160
                    $texto = '';
1161
                    $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...
1162
                }
1163
            }
1164
        }
1165
        $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...
1166
        //####################################################################################
1167
        //INSCRIÇÃO ESTADUAL
1168
        $w     = round($maxW * 0.250, 0);
1169
        $y     += $h;
1170
        $oldY  += $h;
1171
        $x     = $oldX;
1172
        $texto = 'INSCRIÇÃO ESTADUAL';
1173
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1174
        $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...
1175
        $texto = $this->getTagValue($this->emit, "IE");
1176
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1177
        $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...
1178
        //INSCRIÇÃO MUNICIPAL
1179
        $x     += $w;
1180
        $texto = 'INSCRIÇÃO MUNICIPAL';
1181
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1182
        $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...
1183
        $texto = $this->getTagValue($this->emit, "IM");
1184
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1185
        $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...
1186
        //INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.
1187
        $x     += $w;
1188
        $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.';
1189
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1190
        $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...
1191
        $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1192
            ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue
1193
            : '';
1194
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1195
        $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...
1196
        //CNPJ
1197
        $x     += $w;
1198
        $w     = ($maxW - (3 * $w));
1199
        $texto = 'CNPJ';
1200
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1201
        $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...
1202
        //Pegando valor do CPF/CNPJ
1203
        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1204
            $texto = $this->formatField(
1205
                $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1206
                "###.###.###/####-##"
1207
            );
1208
        } else {
1209
            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue)
1210
                ? $this->formatField(
1211
                    $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1212
                    "###.###.###-##"
1213
                )
1214
                : '';
1215
        }
1216
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1217
        $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...
1218
1219
        //####################################################################################
1220
        //Indicação de NF Homologação, cancelamento e falta de protocolo
1221
        $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...
1222
        //indicar cancelamento
1223
        $resp = $this->statusNFe();
1224
        if (! $resp['status']) {
1225
            $x = 10;
1226
            $y = $this->hPrint - 130;
1227
            $h = 25;
1228
            $w = $maxW - (2 * $x);
1229
            $this->pdf->settextcolor(90, 90, 90);
1230
            $texto = $resp['message'];
1231
            $aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B'];
1232
            $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...
1233
            $y += $h;
1234
            $h = 5;
1235
            $w = $maxW - (2 * $x);
1236
            if (isset($this->infProt) && $resp['status']) {
1237
                $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue;
1238
            } else {
1239
                $xMotivo = '';
1240
            }
1241
            $texto = "SEM VALOR FISCAL\n" . $xMotivo;
1242
            $aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B'];
1243
            $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...
1244
            $this->pdf->settextcolor(0, 0, 0);
1245
        }
1246
        if ($this->notaDpec() || $this->tpEmis == 4) {
1247
            //DPEC
1248
            $x = 10;
1249
            $y = $this->hPrint - 130;
1250
            $h = 25;
1251
            $w = $maxW - (2 * $x);
1252
            $this->pdf->SetTextColor(200, 200, 200);
1253
            $texto = "DANFE impresso em contingência -\n" .
1254
                "DPEC regularmente recebido pela Receita\n" .
1255
                "Federal do Brasil";
1256
            $aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B'];
1257
            $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...
1258
            $this->pdf->SetTextColor(0, 0, 0);
1259
        }
1260
1261
        return $oldY;
1262
    } //fim header
1263
1264
    /**
1265
     * destinatarioDANFE
1266
     * Monta o campo com os dados do destinatário na DANFE. (retrato e paisagem)
1267
     *
1268
     * @name   destinatarioDANFE
1269
     *
1270
     * @param number $x Posição horizontal canto esquerdo
1271
     * @param number $y Posição vertical canto superior
1272
     *
1273
     * @return number Posição vertical final
1274
     */
1275
    protected function destinatarioDANFE($x = 0, $y = 0)
1276
    {
1277
        //####################################################################################
1278
        //DESTINATÁRIO / REMETENTE
1279
        $oldX = $x;
1280
        $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...
1281
        if ($this->orientacao == 'P') {
1282
            $maxW = $this->wPrint;
1283
        } else {
1284
            $maxW = $this->wPrint - $this->wCanhoto;
1285
        }
1286
        $w     = $maxW;
1287
        $h     = 7;
1288
        $texto = 'DESTINATÁRIO / REMETENTE';
1289
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1290
        $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...
1291
        //NOME / RAZÃO SOCIAL
1292
        $w     = round($maxW * 0.61, 0);
1293
        $w1    = $w;
1294
        $y     += 3;
1295
        $texto = 'NOME / RAZÃO SOCIAL';
1296
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1297
        $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...
1298
        $texto = $this->dest->getElementsByTagName("xNome")->item(0)->nodeValue;
1299
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1300
        if ($this->orientacao == 'P') {
1301
            $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...
1302
        } else {
1303
            $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...
1304
        }
1305
        //CNPJ / CPF
1306
        $x     += $w;
1307
        $w     = round($maxW * 0.23, 0);
1308
        $w2    = $w;
1309
        $texto = 'CNPJ / CPF';
1310
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1311
        $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...
1312
        //Pegando valor do CPF/CNPJ
1313
        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1314
            $texto = $this->formatField(
1315
                $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1316
                "###.###.###/####-##"
1317
            );
1318
        } else {
1319
            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue)
1320
                ? $this->formatField(
1321
                    $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1322
                    "###.###.###-##"
1323
                )
1324
                : '';
1325
        }
1326
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1327
        $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...
1328
        //DATA DA EMISSÃO
1329
        $x     += $w;
1330
        $w     = $maxW - ($w1 + $w2);
1331
        $wx    = $w;
1332
        $texto = 'DATA DA EMISSÃO';
1333
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1334
        $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...
1335
        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue)
1336
            ? $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue
1337
            : '';
1338
        if ($dEmi == '') {
1339
            $dEmi  = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue)
1340
                ? $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue
1341
                : '';
1342
            $aDemi = explode('T', $dEmi);
1343
            $dEmi  = $aDemi[0];
1344
        }
1345
        $texto = $this->ymdTodmy($dEmi);
1346
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1347
        if ($this->orientacao == 'P') {
1348
            $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...
1349
        } else {
1350
            $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...
1351
        }
1352
        //ENDEREÇO
1353
        $w     = round($maxW * 0.47, 0);
1354
        $w1    = $w;
1355
        $y     += $h;
1356
        $x     = $oldX;
1357
        $texto = 'ENDEREÇO';
1358
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1359
        $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...
1360
        $texto = $this->dest->getElementsByTagName("xLgr")->item(0)->nodeValue;
1361
        $texto .= ', ' . $this->dest->getElementsByTagName("nro")->item(0)->nodeValue;
1362
        $texto .= $this->getTagValue($this->dest, "xCpl", " - ");
1363
1364
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1365
        $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...
1366
        //BAIRRO / DISTRITO
1367
        $x     += $w;
1368
        $w     = round($maxW * 0.21, 0);
1369
        $w2    = $w;
1370
        $texto = 'BAIRRO / DISTRITO';
1371
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1372
        $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...
1373
        $texto = $this->dest->getElementsByTagName("xBairro")->item(0)->nodeValue;
1374
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1375
        $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...
1376
        //CEP
1377
        $x     += $w;
1378
        $w     = $maxW - $w1 - $w2 - $wx;
1379
        $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...
1380
        $texto = 'CEP';
1381
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1382
        $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...
1383
        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue)
1384
            ? $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue
1385
            : '';
1386
        $texto = $this->formatField($texto, "#####-###");
1387
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1388
        $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...
1389
        //DATA DA SAÍDA
1390
        $x     += $w;
1391
        $w     = $wx;
1392
        $texto = 'DATA DA SAÍDA/ENTRADA';
1393
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1394
        $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...
1395
        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue)
1396
            ? $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue
1397
            : '';
1398
        if ($dSaiEnt == '') {
1399
            $dSaiEnt  = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1400
                ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1401
                : '';
1402
            $aDsaient = explode('T', $dSaiEnt);
1403
            $dSaiEnt  = $aDsaient[0];
1404
        }
1405
        $texto = $this->ymdTodmy($dSaiEnt);
1406
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1407
        $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...
1408
        //MUNICÍPIO
1409
        $w     = $w1;
1410
        $y     += $h;
1411
        $x     = $oldX;
1412
        $texto = 'MUNICÍPIO';
1413
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1414
        $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...
1415
        $texto = $this->dest->getElementsByTagName("xMun")->item(0)->nodeValue;
1416
        if (strtoupper(trim($texto)) == "EXTERIOR"
1417
            && $this->dest->getElementsByTagName("xPais")->length > 0
1418
        ) {
1419
            $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1420
        }
1421
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1422
        $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...
1423
        //UF
1424
        $x     += $w;
1425
        $w     = 8;
1426
        $texto = 'UF';
1427
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1428
        $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...
1429
        $texto = $this->dest->getElementsByTagName("UF")->item(0)->nodeValue;
1430
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1431
        $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...
1432
        //FONE / FAX
1433
        $x     += $w;
1434
        $w     = round(($maxW - $w1 - $wx - 8) / 2, 0);
1435
        $w3    = $w;
1436
        $texto = 'FONE / FAX';
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
        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue)
1440
            ? $this->dest->getElementsByTagName("fone")->item(0)->nodeValue
1441
            : '';
1442
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1443
        $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...
1444
        //INSCRIÇÃO ESTADUAL
1445
        $x     += $w;
1446
        $w     = $maxW - $w1 - $wx - 8 - $w3;
1447
        $texto = 'INSCRIÇÃO ESTADUAL';
1448
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1449
        $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...
1450
        $IE    = $this->dest->getElementsByTagName("IE");
1451
        $texto = ($IE && $IE->length > 0) ? $IE->item(0)->nodeValue : '';
1452
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1453
        $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...
1454
        //HORA DA SAÍDA
1455
        $x     += $w;
1456
        $w     = $wx;
1457
        $texto = 'HORA DA SAÍDA/ENTRADA';
1458
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1459
        $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...
1460
        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue)
1461
            ? $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue
1462
            : '';
1463
        if ($hSaiEnt == '') {
1464
            $dhSaiEnt   = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1465
                ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1466
                : '';
1467
            $tsDhSaiEnt = $this->toTimestamp($dhSaiEnt);
1468
            if ($tsDhSaiEnt != '') {
1469
                $hSaiEnt = date('H:i:s', $tsDhSaiEnt);
1470
            }
1471
        }
1472
        $texto = $hSaiEnt;
1473
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1474
        $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...
1475
1476
        return ($y + $h);
1477
    } //fim da função destinatarioDANFE
1478
1479
    /**
1480
     * localEntregaDANFE
1481
     * Monta o campo com os dados do local de entrega na DANFE. (retrato e paisagem)
1482
     *
1483
     * @name   localEntregaDANFE
1484
     *
1485
     * @param number $x Posição horizontal canto esquerdo
1486
     * @param number $y Posição vertical canto superior
1487
     *
1488
     * @return number Posição vertical final
1489
     */
1490
    protected function localEntregaDANFE($x = 0, $y = 0)
1491
    {
1492
        //####################################################################################
1493
        //LOCAL DE ENTREGA
1494
        $oldX = $x;
1495
        if ($this->orientacao == 'P') {
1496
            $maxW = $this->wPrint;
1497
        } else {
1498
            $maxW = $this->wPrint - $this->wCanhoto;
1499
        }
1500
        $w     = $maxW;
1501
        $h     = 7;
1502
        $texto = 'INFORMAÇÕES DO LOCAL DE ENTREGA';
1503
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1504
        $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...
1505
        //NOME / RAZÃO SOCIAL
1506
        $w     = round($maxW * 0.61, 0);
1507
        $w1    = $w;
1508
        $y     += 3;
1509
        $texto = 'NOME / RAZÃO SOCIAL';
1510
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1511
        $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...
1512
        $texto = '';
1513
        if ($this->entrega->getElementsByTagName("xNome")->item(0)) {
1514
            $texto = $this->entrega->getElementsByTagName("xNome")->item(0)->nodeValue;
1515
        }
1516
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1517
        if ($this->orientacao == 'P') {
1518
            $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...
1519
        } else {
1520
            $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...
1521
        }
1522
        //CNPJ / CPF
1523
        $x     += $w;
1524
        $w     = round($maxW * 0.23, 0);
1525
        $w2    = $w;
1526
        $texto = 'CNPJ / CPF';
1527
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1528
        $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...
1529
        //Pegando valor do CPF/CNPJ
1530
        if (! empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1531
            $texto = $this->formatField(
1532
                $this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1533
                "###.###.###/####-##"
1534
            );
1535
        } else {
1536
            $texto = ! empty($this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1537
                $this->formatField(
1538
                    $this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue,
1539
                    "###.###.###-##"
1540
                ) : '';
1541
        }
1542
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1543
        $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...
1544
        //INSCRIÇÃO ESTADUAL
1545
        $x     += $w;
1546
        $w     = $maxW - ($w1 + $w2);
1547
        $wx    = $w;
1548
        $texto = 'INSCRIÇÃO ESTADUAL';
1549
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1550
        $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...
1551
        $texto = '';
1552
        if ($this->entrega->getElementsByTagName("IE")->item(0)) {
1553
            $texto = $this->entrega->getElementsByTagName("IE")->item(0)->nodeValue;
1554
        }
1555
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1556
        if ($this->orientacao == 'P') {
1557
            $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...
1558
        } else {
1559
            $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...
1560
        }
1561
        //ENDEREÇO
1562
        $w     = round($maxW * 0.355, 0) + $wx;
1563
        $w1    = $w;
1564
        $y     += $h;
1565
        $x     = $oldX;
1566
        $texto = 'ENDEREÇO';
1567
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1568
        $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...
1569
        $texto = $this->entrega->getElementsByTagName("xLgr")->item(0)->nodeValue;
1570
        $texto .= ', ' . $this->entrega->getElementsByTagName("nro")->item(0)->nodeValue;
1571
        $texto .= $this->getTagValue($this->entrega, "xCpl", " - ");
1572
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1573
        $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...
1574
        //BAIRRO / DISTRITO
1575
        $x     += $w;
1576
        $w     = round($maxW * 0.335, 0);
1577
        $w2    = $w;
1578
        $texto = 'BAIRRO / DISTRITO';
1579
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1580
        $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...
1581
        $texto = $this->entrega->getElementsByTagName("xBairro")->item(0)->nodeValue;
1582
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1583
        $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...
1584
        //CEP
1585
        $x     += $w;
1586
        $w     = $maxW - ($w1 + $w2);
1587
        $texto = 'CEP';
1588
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1589
        $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...
1590
        $texto = ! empty($this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1591
            $this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1592
        $texto = $this->formatField($texto, "#####-###");
1593
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1594
        $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...
1595
        //MUNICÍPIO
1596
        $w     = round($maxW * 0.805, 0);
1597
        $w1    = $w;
1598
        $y     += $h;
1599
        $x     = $oldX;
1600
        $texto = 'MUNICÍPIO';
1601
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1602
        $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...
1603
        $texto = $this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue;
1604
        if (strtoupper(trim($texto)) == "EXTERIOR" && $this->entrega->getElementsByTagName("xPais")->length > 0) {
1605
            $texto .= " - " . $this->entrega->getElementsByTagName("xPais")->item(0)->nodeValue;
1606
        }
1607
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1608
        $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...
1609
        //UF
1610
        $x     += $w;
1611
        $w     = 8;
1612
        $texto = 'UF';
1613
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1614
        $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...
1615
        $texto = $this->entrega->getElementsByTagName("UF")->item(0)->nodeValue;
1616
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1617
        $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...
1618
        //FONE / FAX
1619
        $x     += $w;
1620
        $w     = $maxW - $w - $w1;
1621
        $texto = 'FONE / FAX';
1622
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1623
        $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...
1624
        $texto = ! empty($this->entrega->getElementsByTagName("fone")->item(0)->nodeValue) ?
1625
            $this->entrega->getElementsByTagName("fone")->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
1629
        return ($y + $h);
1630
    } //fim da função localEntregaDANFE
1631
1632
    /**
1633
     * localretiradaDANFE
1634
     * Monta o campo com os dados do local de entrega na DANFE. (retrato e paisagem)
1635
     *
1636
     * @name   localretiradaDANFE
1637
     *
1638
     * @param number $x Posição horizontal canto esquerdo
1639
     * @param number $y Posição vertical canto superior
1640
     *
1641
     * @return number Posição vertical final
1642
     */
1643
    protected function localRetiradaDANFE($x = 0, $y = 0)
1644
    {
1645
        //####################################################################################
1646
        //LOCAL DE RETIRADA
1647
        $oldX = $x;
1648
        if ($this->orientacao == 'P') {
1649
            $maxW = $this->wPrint;
1650
        } else {
1651
            $maxW = $this->wPrint - $this->wCanhoto;
1652
        }
1653
        $w     = $maxW;
1654
        $h     = 7;
1655
        $texto = 'INFORMAÇÕES DO LOCAL DE RETIRADA';
1656
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1657
        $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...
1658
        //NOME / RAZÃO SOCIAL
1659
        $w     = round($maxW * 0.61, 0);
1660
        $w1    = $w;
1661
        $y     += 3;
1662
        $texto = 'NOME / RAZÃO SOCIAL';
1663
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1664
        $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...
1665
        $texto = '';
1666
        if ($this->retirada->getElementsByTagName("xNome")->item(0)) {
1667
            $texto = $this->retirada->getElementsByTagName("xNome")->item(0)->nodeValue;
1668
        }
1669
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1670
        if ($this->orientacao == 'P') {
1671
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1672
        } else {
1673
            $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...
1674
        }
1675
        //CNPJ / CPF
1676
        $x     += $w;
1677
        $w     = round($maxW * 0.23, 0);
1678
        $w2    = $w;
1679
        $texto = 'CNPJ / CPF';
1680
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1681
        $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...
1682
        //Pegando valor do CPF/CNPJ
1683
        if (! empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1684
            $texto = $this->formatField(
1685
                $this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1686
                "###.###.###/####-##"
1687
            );
1688
        } else {
1689
            $texto = ! empty($this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1690
                $this->formatField(
1691
                    $this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue,
1692
                    "###.###.###-##"
1693
                ) : '';
1694
        }
1695
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1696
        $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...
1697
        //INSCRIÇÃO ESTADUAL
1698
        $x     += $w;
1699
        $w     = $maxW - ($w1 + $w2);
1700
        $wx    = $w;
1701
        $texto = 'INSCRIÇÃO ESTADUAL';
1702
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1703
        $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...
1704
        $texto = '';
1705
        if ($this->retirada->getElementsByTagName("IE")->item(0)) {
1706
            $texto = $this->retirada->getElementsByTagName("IE")->item(0)->nodeValue;
1707
        }
1708
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1709
        if ($this->orientacao == 'P') {
1710
            $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...
1711
        } else {
1712
            $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...
1713
        }
1714
        //ENDEREÇO
1715
        $w     = round($maxW * 0.355, 0) + $wx;
1716
        $w1    = $w;
1717
        $y     += $h;
1718
        $x     = $oldX;
1719
        $texto = 'ENDEREÇO';
1720
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1721
        $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...
1722
        $texto = $this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue;
1723
        $texto .= ', ' . $this->retirada->getElementsByTagName("nro")->item(0)->nodeValue;
1724
        $texto .= $this->getTagValue($this->retirada, "xCpl", " - ");
1725
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1726
        $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...
1727
        //BAIRRO / DISTRITO
1728
        $x     += $w;
1729
        $w     = round($maxW * 0.335, 0);
1730
        $w2    = $w;
1731
        $texto = 'BAIRRO / DISTRITO';
1732
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1733
        $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...
1734
        $texto = $this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue;
1735
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1736
        $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...
1737
        //CEP
1738
        $x     += $w;
1739
        $w     = $maxW - ($w1 + $w2);
1740
        $texto = 'CEP';
1741
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1742
        $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...
1743
        $texto = ! empty($this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1744
            $this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1745
        $texto = $this->formatField($texto, "#####-###");
1746
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1747
        $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...
1748
        //MUNICÍPIO
1749
        $w     = round($maxW * 0.805, 0);
1750
        $w1    = $w;
1751
        $y     += $h;
1752
        $x     = $oldX;
1753
        $texto = 'MUNICÍPIO';
1754
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1755
        $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...
1756
        $texto = $this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue;
1757
        if (strtoupper(trim($texto)) == "EXTERIOR" && $this->retirada->getElementsByTagName("xPais")->length > 0) {
1758
            $texto .= " - " . $this->retirada->getElementsByTagName("xPais")->item(0)->nodeValue;
1759
        }
1760
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1761
        $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...
1762
        //UF
1763
        $x     += $w;
1764
        $w     = 8;
1765
        $texto = 'UF';
1766
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1767
        $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...
1768
        $texto = $this->retirada->getElementsByTagName("UF")->item(0)->nodeValue;
1769
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1770
        $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...
1771
        //FONE / FAX
1772
        $x     += $w;
1773
        $w     = $maxW - $w - $w1;
1774
        $texto = 'FONE / FAX';
1775
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1776
        $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...
1777
        $texto = ! empty($this->retirada->getElementsByTagName("fone")->item(0)->nodeValue) ?
1778
            $this->retirada->getElementsByTagName("fone")->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
1782
        return ($y + $h);
1783
    } //fim da função localRetiradaDANFE
1784
1785
    /**
1786
     * getTextoFatura
1787
     * Gera a String do Texto da Fatura
1788
     *
1789
     * @name   getTextoFatura
1790
     * @return uma String com o texto ou "";
1791
     */
1792
    protected function getTextoFatura()
1793
    {
1794
        if (isset($this->cobr)) {
1795
            $fat = $this->cobr->getElementsByTagName("fat")->item(0);
1796
            if (isset($fat)) {
1797
                if (! empty($this->getTagValue($this->ide, "indPag"))) {
1798
                    $textoIndPag = "";
1799
                    $indPag      = $this->getTagValue($this->ide, "indPag");
1800
                    if ($indPag === "0") {
1801
                        $textoIndPag = "Pagamento à Vista - ";
1802
                    } elseif ($indPag === "1") {
1803
                        $textoIndPag = "Pagamento à Prazo - ";
1804
                    }
1805
                    $nFat  = $this->getTagValue($fat, "nFat", "Fatura: ");
1806
                    $vOrig = $this->getTagValue($fat, "vOrig", " Valor Original: ");
1807
                    $vDesc = $this->getTagValue($fat, "vDesc", " Desconto: ");
1808
                    $vLiq  = $this->getTagValue($fat, "vLiq", " Valor Líquido: ");
1809
                    $texto = $textoIndPag . $nFat . $vOrig . $vDesc . $vLiq;
1810
1811
                    return $texto;
1812
                } else {
1813
                    $pag = $this->dom->getElementsByTagName("pag");
1814
                    if ($tPag = $this->getTagValue($pag->item(0), "tPag")) {
1815
                        return $this->tipoPag($tPag);
1816
                    }
1817
                }
1818
            }
1819
        }
1820
1821
        return "";
1822
    }
1823
1824
    /**
1825
     * sizeExtraTextoFatura
1826
     * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata.
1827
     *
1828
     * @name   sizeExtraTextoFatura
1829
     * @return integer
1830
     */
1831
    protected function sizeExtraTextoFatura()
1832
    {
1833
        $textoFatura = $this->getTextoFatura();
1834
        //verificar se existem duplicatas
1835
        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...
1836
            return 10;
1837
        }
1838
1839
        return 0;
1840
    }
1841
1842
    /**
1843
     * fatura
1844
     * Monta o campo de duplicatas da DANFE (retrato e paisagem)
1845
     *
1846
     * @name   fatura
1847
     *
1848
     * @param number $x Posição horizontal canto esquerdo
1849
     * @param number $y Posição vertical canto superior
1850
     *
1851
     * @return number Posição vertical final
1852
     */
1853
    protected function fatura($x, $y)
1854
    {
1855
        $linha       = 1;
1856
        $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...
1857
        $oldx        = $x;
1858
        $textoFatura = $this->getTextoFatura();
1859
        //verificar se existem duplicatas
1860
        if ($this->dup->length > 0 || $textoFatura !== "") {
1861
            //#####################################################################
1862
            //FATURA / DUPLICATA
1863
            $texto = $y . " - FATURA / DUPLICATA";
1864
            if ($this->orientacao == 'P') {
1865
                $w = $this->wPrint;
1866
            } else {
1867
                $w = 271;
1868
            }
1869
            $h     = 8;
1870
            $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1871
            $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...
1872
            $y       += 3;
1873
            $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...
1874
            $dupcont = 0;
1875
            $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...
1876
            if ($nFat > 7) {
1877
                $myH = 6;
1878
                $myW = $this->wPrint;
1879
                if ($this->orientacao == 'L') {
1880
                    $myW -= $this->wCanhoto;
1881
                }
1882
                $aFont = ['font' => $this->fontePadrao, 'size' => 9, 'style' => ''];
1883
                $texto = "Existem mais de 7 duplicatas registradas, portanto não "
1884
                    . "serão exibidas, confira diretamente pelo XML.";
1885
                $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...
1886
1887
                return ($y + $h - 3);
1888
            }
1889
            if ($textoFatura !== "" && $this->exibirTextoFatura) {
1890
                $myH = 6;
1891
                $myW = $this->wPrint;
1892
                if ($this->orientacao == 'L') {
1893
                    $myW -= $this->wCanhoto;
1894
                }
1895
                $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
1896
                $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...
1897
                $y += $myH + 1;
1898
            }
1899
            if ($this->orientacao == 'P') {
1900
                $w = round($this->wPrint / 7.018, 0) - 1;
1901
            } else {
1902
                $w = 28;
1903
            }
1904
            $increm = 1;
1905
            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...
1906
                $nDup  = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue)
1907
                    ? $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue
1908
                    : '';
1909
                $dDup  = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
1910
                    ? $this->ymdTodmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
1911
                    : '';
1912
                $vDup  = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue)
1913
                    ? 'R$ ' . number_format(
1914
                        $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
1915
                        2,
1916
                        ",",
1917
                        "."
1918
                    )
1919
                    : '';
1920
                $h     = 8;
1921
                $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...
1922
                if ($nDup != '0' && $nDup != '') {
1923
                    $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1924
                    $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...
1925
                    $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1926
                    $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...
1927
                } else {
1928
                    $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1929
                    $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...
1930
                }
1931
                $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1932
                $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...
1933
                $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1934
                $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...
1935
                $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1936
                $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...
1937
                $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1938
                $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...
1939
                $x       += $w + $increm;
1940
                $dupcont += 1;
1941
                if ($this->orientacao == 'P') {
1942
                    $maxDupCont = 6;
1943
                } else {
1944
                    $maxDupCont = 8;
1945
                }
1946
                if ($dupcont > $maxDupCont) {
1947
                    $y       += 9;
1948
                    $x       = $oldx;
1949
                    $dupcont = 0;
1950
                    $linha   += 1;
1951
                }
1952
                if ($linha == 5) {
1953
                    $linha = 4;
1954
                    break;
1955
                }
1956
            }
1957
            if ($dupcont == 0) {
1958
                $y -= 9;
1959
                $linha --;
1960
            }
1961
1962
            return ($y + $h);
1963
        } else {
1964
            $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...
1965
1966
            return ($y - 2);
1967
        }
1968
    }
1969
1970
    /**
1971
     * pagamento
1972
     * Monta o campo de pagamentos da DANFE (retrato e paisagem) (foi baseada na fatura)
1973
     *
1974
     * @name   pagamento
1975
     *
1976
     * @param number $x Posição horizontal canto esquerdo
1977
     * @param number $y Posição vertical canto superior
1978
     *
1979
     * @return number Posição vertical final
1980
     */
1981
    protected function pagamento($x, $y)
1982
    {
1983
        $linha = 1;
1984
        $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...
1985
        $oldx  = $x;
1986
        //verificar se existem cobranças definidas
1987
        if (isset($this->detPag) && $this->detPag->length > 0) {
1988
            //#####################################################################
1989
            //Tipo de pagamento
1990
            $texto = "PAGAMENTO";
1991
            if ($this->orientacao == 'P') {
1992
                $w = $this->wPrint;
1993
            } else {
1994
                $w = 271;
1995
            }
1996
            $h     = 8;
1997
            $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1998
            $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...
1999
            $y       += 3;
2000
            $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...
2001
            $dupcont = 0;
2002
            if ($this->orientacao == 'P') {
2003
                $w = round($this->wPrint / 7.018, 0) - 1;
2004
            } else {
2005
                $w = 28;
2006
            }
2007
            if ($this->orientacao == 'P') {
2008
                $maxDupCont = 6;
2009
            } else {
2010
                $maxDupCont = 8;
2011
            }
2012
            $increm         = 1;
2013
            $formaPagamento = [
2014
                '01' => 'Dinheiro',
2015
                '02' => 'Cheque',
2016
                '03' => 'Cartão de Crédito',
2017
                '04' => 'Cartão de Débito',
2018
                '05' => 'Crédito Loja',
2019
                '10' => 'Vale Alimentação',
2020
                '11' => 'Vale Refeição',
2021
                '12' => 'Vale Presente',
2022
                '13' => 'Vale Combustível',
2023
                '14' => 'Duplicata Mercantil',
2024
                '15' => 'Boleto',
2025
                '90' => 'Sem pagamento',
2026
                '99' => 'Outros'
2027
            ];
2028
            $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...
2029
                '01' => 'Visa',
2030
                '02' => 'Mastercard',
2031
                '03' => 'American',
2032
                '04' => 'Sorocred',
2033
                '05' => 'Diners',
2034
                '06' => 'Elo',
2035
                '07' => 'Hipercard',
2036
                '08' => 'Aura',
2037
                '09' => 'Cabal',
2038
                '99' => 'Outros'
2039
            ];
2040
            foreach ($this->detPag as $k => $d) {
2041
                $fPag  = ! empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
2042
                    ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue
2043
                    : '0';
2044
                $vPag  = ! empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
2045
                    ? 'R$ ' . number_format(
2046
                        $this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue,
2047
                        2,
2048
                        ",",
2049
                        "."
2050
                    )
2051
                    : '';
2052
                $h     = 6;
2053
                $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...
2054
                if (isset($formaPagamento[$fPag])) {
2055
                    /*Exibir Item sem pagamento*/
2056
                    if ($fPag == '90') {
2057
                        continue;
2058
                    }
2059
                    $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2060
                    $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...
2061
                    $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2062
                    $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...
2063
                } else {
2064
                    $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
2065
                    $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...
2066
                }
2067
                $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2068
                $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...
2069
                $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2070
                $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...
2071
                $x       += $w + $increm;
2072
                $dupcont += 1;
2073
2074
                if ($dupcont > $maxDupCont) {
2075
                    $y       += 9;
2076
                    $x       = $oldx;
2077
                    $dupcont = 0;
2078
                    $linha   += 1;
2079
                }
2080
                if ($linha == 5) {
2081
                    $linha = 4;
2082
                    break;
2083
                }
2084
            }
2085
            if ($dupcont == 0) {
2086
                $y -= 9;
2087
                $linha --;
2088
            }
2089
2090
            return ($y + $h);
2091
        } else {
2092
            $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...
2093
2094
            return ($y - 2);
2095
        }
2096
    } //fim da função pagamento
2097
2098
    /**
2099
     * impostoHelper
2100
     * Auxilia a montagem dos campos de impostos e totais da DANFE
2101
     *
2102
     * @name   impostoHelper
2103
     *
2104
     * @param float $x Posição horizontal canto esquerdo
2105
     * @param float $y Posição vertical canto superior
2106
     * @param float $w Largura do campo
2107
     * @param float $h Altura do campo
2108
     * @param float $h Título do campo
2109
     * @param float $h Valor do imposto
2110
     *
2111
     * @return float Sugestão do $x do próximo imposto
2112
     */
2113
    protected function impostoHelper($x, $y, $w, $h, $titulo, $campoImposto)
2114
    {
2115
        $valorImposto = '0,00';
2116
        $the_field    = $this->ICMSTot->getElementsByTagName($campoImposto)->item(0);
2117
        if (isset($the_field)) {
2118
            $the_value = $the_field->nodeValue;
2119
            if (! empty($the_value)) {
2120
                $valorImposto = number_format($the_value, 2, ",", ".");
2121
            }
2122
        }
2123
2124
        $fontTitulo = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2125
        $fontValor  = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2126
        $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...
2127
        $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...
2128
2129
        $next_x = $x + $w;
2130
2131
        return $next_x;
2132
    }
2133
2134
    /**
2135
     * imposto
2136
     * Monta o campo de impostos e totais da DANFE (retrato e paisagem)
2137
     *
2138
     * @param number $x Posição horizontal canto esquerdo
2139
     * @param number $y Posição vertical canto superior
2140
     *
2141
     * @return number Posição vertical final
2142
     */
2143
    protected function imposto($x, $y)
2144
    {
2145
        $x_inicial = $x;
2146
        //#####################################################################
2147
        $campos_por_linha = 9;
2148
        if (! $this->exibirPIS) {
2149
            $campos_por_linha --;
2150
        }
2151
        if (! $this->exibirIcmsInterestadual) {
2152
            $campos_por_linha -= 2;
2153
        }
2154
2155
        if ($this->orientacao == 'P') {
2156
            $maxW       = $this->wPrint;
2157
            $title_size = 31;
2158
        } else {
2159
            $maxW       = $this->wPrint - $this->wCanhoto;
2160
            $title_size = 40;
2161
        }
2162
        $w = $maxW / $campos_por_linha;
2163
2164
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2165
        $texto = "CÁLCULO DO IMPOSTO";
2166
        $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...
2167
        $y += 3;
2168
        $h = 7;
2169
2170
        $x = $this->impostoHelper($x, $y, $w, $h, "BASE DE CÁLC. DO ICMS", "vBC");
2171
        $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DO ICMS", "vICMS");
2172
        $x = $this->impostoHelper($x, $y, $w, $h, "BASE DE CÁLC. ICMS S.T.", "vBCST");
2173
        $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DO ICMS SUBST.", "vST");
2174
        $x = $this->impostoHelper($x, $y, $w, $h, "V. IMP. IMPORTAÇÃO", "vII");
2175
2176
        if ($this->exibirIcmsInterestadual) {
2177
            $x = $this->impostoHelper($x, $y, $w, $h, "V. ICMS UF REMET.", "vICMSUFRemet");
2178
            $x = $this->impostoHelper($x, $y, $w, $h, "V. FCP UF DEST.", "vFCPUFDest");
2179
        }
2180
2181
        if ($this->exibirPIS) {
2182
            $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DO PIS", "vPIS");
2183
        }
2184
2185
        $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...
2186
2187
        //
2188
2189
        $y += $h;
2190
        $x = $x_inicial;
2191
2192
        $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DO FRETE", "vFrete");
2193
        $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DO SEGURO", "vSeg");
2194
        $x = $this->impostoHelper($x, $y, $w, $h, "DESCONTO", "vDesc");
2195
        $x = $this->impostoHelper($x, $y, $w, $h, "OUTRAS DESPESAS", "vOutro");
2196
        $x = $this->impostoHelper($x, $y, $w, $h, "VALOR TOTAL IPI", "vIPI");
2197
2198
        if ($this->exibirIcmsInterestadual) {
2199
            $x = $this->impostoHelper($x, $y, $w, $h, "V. ICMS UF DEST.", "vICMSUFDest");
2200
            $x = $this->impostoHelper($x, $y, $w, $h, "V. TOT. TRIB.", "vTotTrib");
2201
        }
2202
        if ($this->exibirPIS) {
2203
            $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DA COFINS", "vCOFINS");
2204
        }
2205
        $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...
2206
2207
        return ($y + $h);
2208
    } //fim imposto
2209
2210
    /**
2211
     * transporte
2212
     * Monta o campo de transportes da DANFE (retrato e paisagem)
2213
     *
2214
     * @name   transporte
2215
     *
2216
     * @param float $x Posição horizontal canto esquerdo
2217
     * @param float $y Posição vertical canto superior
2218
     *
2219
     * @return float Posição vertical final
2220
     */
2221
    protected function transporte($x, $y)
2222
    {
2223
        $oldX = $x;
2224
        if ($this->orientacao == 'P') {
2225
            $maxW = $this->wPrint;
2226
        } else {
2227
            $maxW = $this->wPrint - $this->wCanhoto;
2228
        }
2229
        //#####################################################################
2230
        //TRANSPORTADOR / VOLUMES TRANSPORTADOS
2231
        $texto = "TRANSPORTADOR / VOLUMES TRANSPORTADOS";
2232
        $w     = $maxW;
2233
        $h     = 7;
2234
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2235
        $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...
2236
        //NOME / RAZÃO SOCIAL
2237
        $w1    = $maxW * 0.29;
2238
        $y     += 3;
2239
        $texto = 'NOME / RAZÃO SOCIAL';
2240
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2241
        $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...
2242
        if (isset($this->transporta)) {
2243
            $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue)
2244
                ? $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue
2245
                : '';
2246
        } else {
2247
            $texto = '';
2248
        }
2249
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2250
        $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...
2251
        //FRETE POR CONTA
2252
        $x     += $w1;
2253
        $w2    = $maxW * 0.15;
2254
        $texto = 'FRETE';
2255
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2256
        $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...
2257
        $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue)
2258
            ? $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue
2259
            : '0';
2260
        switch ($tipoFrete) {
2261
            case 0:
2262
                $texto = "0-Por conta do Rem";
2263
                break;
2264
            case 1:
2265
                $texto = "1-Por conta do Dest";
2266
                break;
2267
            case 2:
2268
                $texto = "2-Por conta de Terceiros";
2269
                break;
2270
            case 3:
2271
                $texto = "3-Próprio por conta do Rem";
2272
                break;
2273
            case 4:
2274
                $texto = "4-Próprio por conta do Dest";
2275
                break;
2276
            case 9:
2277
                $texto = "9-Sem Transporte";
2278
                break;
2279
        }
2280
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2281
        $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...
2282
        //CÓDIGO ANTT
2283
        $x     += $w2;
2284
        $texto = 'CÓDIGO ANTT';
2285
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2286
        $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...
2287
        if (isset($this->veicTransp)) {
2288
            $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue)
2289
                ? $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue
2290
                : '';
2291
        } else {
2292
            $texto = '';
2293
        }
2294
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2295
        $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...
2296
        //PLACA DO VEÍC
2297
        $x     += $w2;
2298
        $texto = 'PLACA DO VEÍCULO';
2299
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2300
        $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...
2301
        if (isset($this->veicTransp)) {
2302
            $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue)
2303
                ? $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue
2304
                : '';
2305
        } elseif (isset($this->reboque)) {
2306
            $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue)
2307
                ? $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue
2308
                : '';
2309
        } else {
2310
            $texto = '';
2311
        }
2312
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2313
        $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...
2314
        //UF
2315
        $x     += $w2;
2316
        $w3    = round($maxW * 0.04, 0);
2317
        $texto = 'UF';
2318
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2319
        $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...
2320
        if (isset($this->veicTransp)) {
2321
            $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue)
2322
                ? $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue
2323
                : '';
2324
        } elseif (isset($this->reboque)) {
2325
            $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue)
2326
                ? $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue
2327
                : '';
2328
        } else {
2329
            $texto = '';
2330
        }
2331
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2332
        $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...
2333
        //CNPJ / CPF
2334
        $x     += $w3;
2335
        $w     = $maxW - ($w1 + 3 * $w2 + $w3);
2336
        $texto = 'CNPJ / CPF';
2337
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2338
        $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...
2339
        if (isset($this->transporta)) {
2340
            $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue)
2341
                ? $this->formatField(
2342
                    $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,
2343
                    "##.###.###/####-##"
2344
                )
2345
                : '';
2346
            if ($texto == '') {
2347
                $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue)
2348
                    ? $this->formatField(
2349
                        $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue,
2350
                        "###.###.###-##"
2351
                    )
2352
                    : '';
2353
            }
2354
        } else {
2355
            $texto = '';
2356
        }
2357
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2358
        $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...
2359
        //#####################################################################
2360
        //ENDEREÇO
2361
        $y     += $h;
2362
        $x     = $oldX;
2363
        $h     = 7;
2364
        $w1    = $maxW * 0.44;
2365
        $texto = 'ENDEREÇO';
2366
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2367
        $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...
2368
        if (isset($this->transporta)) {
2369
            $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue)
2370
                ? $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue
2371
                : '';
2372
        } else {
2373
            $texto = '';
2374
        }
2375
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2376
        $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...
2377
        //MUNICÍPIO
2378
        $x     += $w1;
2379
        $w2    = round($maxW * 0.30, 0);
2380
        $texto = 'MUNICÍPIO';
2381
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2382
        $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...
2383
        if (isset($this->transporta)) {
2384
            $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue)
2385
                ? $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue
2386
                : '';
2387
        } else {
2388
            $texto = '';
2389
        }
2390
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2391
        $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...
2392
        //UF
2393
        $x     += $w2;
2394
        $w3    = round($maxW * 0.04, 0);
2395
        $texto = 'UF';
2396
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2397
        $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...
2398
        if (isset($this->transporta)) {
2399
            $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue)
2400
                ? $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue
2401
                : '';
2402
        } else {
2403
            $texto = '';
2404
        }
2405
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2406
        $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...
2407
        //INSCRIÇÃO ESTADUAL
2408
        $x     += $w3;
2409
        $w     = $maxW - ($w1 + $w2 + $w3);
2410
        $texto = 'INSCRIÇÃO ESTADUAL';
2411
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2412
        $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...
2413
        $texto = '';
2414
        if (isset($this->transporta)) {
2415
            if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2416
                $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue;
2417
            }
2418
        }
2419
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2420
        $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...
2421
        //Tratar Multiplos volumes
2422
        $volumes     = $this->transp->getElementsByTagName('vol');
2423
        $quantidade  = 0;
2424
        $especie     = '';
2425
        $marca       = '';
2426
        $numero      = '';
2427
        $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...
2428
        $pesoBruto   = 0;
2429
        $pesoLiquido = 0;
2430
        foreach ($volumes as $volume) {
2431
            $quantidade  += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2432
                $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0;
2433
            $pesoBruto   += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2434
                $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0;
2435
            $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2436
                $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0;
2437
            $texto       = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2438
                $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';
2439
            if ($texto != $especie && $especie != '') {
2440
                //tem várias especies
2441
                $especie = 'VARIAS';
2442
            } else {
2443
                $especie = $texto;
2444
            }
2445
            $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue)
2446
                ? $this->transp->getElementsByTagName("marca")->item(0)->nodeValue
2447
                : '';
2448
            if ($texto != $marca && $marca != '') {
2449
                //tem várias especies
2450
                $marca = 'VARIAS';
2451
            } else {
2452
                $marca = $texto;
2453
            }
2454
            $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue)
2455
                ? $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue
2456
                : '';
2457
            if ($texto != $numero && $numero != '') {
2458
                //tem várias especies
2459
                $numero = 'VARIOS';
2460
            } else {
2461
                $numero = $texto;
2462
            }
2463
        }
2464
2465
        //#####################################################################
2466
        //QUANTIDADE
2467
        $y     += $h;
2468
        $x     = $oldX;
2469
        $h     = 7;
2470
        $w1    = round($maxW * 0.10, 0);
2471
        $texto = 'QUANTIDADE';
2472
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2473
        $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...
2474
        if (! empty($quantidade)) {
2475
            $texto = $quantidade;
2476
            $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2477
            $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...
2478
        }
2479
        //ESPÉCIE
2480
        $x     += $w1;
2481
        $w2    = round($maxW * 0.17, 0);
2482
        $texto = 'ESPÉCIE';
2483
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2484
        $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...
2485
        $texto = $especie;
2486
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2487
        $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...
2488
        //MARCA
2489
        $x     += $w2;
2490
        $texto = 'MARCA';
2491
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2492
        $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...
2493
        $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2494
            $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2495
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2496
        $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...
2497
        //NUMERAÇÃO
2498
        $x     += $w2;
2499
        $texto = 'NUMERAÇÃO';
2500
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2501
        $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...
2502
        $texto = $numero;
2503
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2504
        $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...
2505
        //PESO BRUTO
2506
        $x     += $w2;
2507
        $w3    = round($maxW * 0.20, 0);
2508
        $texto = 'PESO BRUTO';
2509
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2510
        $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...
2511
        if (is_numeric($pesoBruto) && $pesoBruto > 0) {
2512
            $texto = number_format($pesoBruto, 3, ",", ".");
2513
        } else {
2514
            $texto = '';
2515
        }
2516
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2517
        $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...
2518
        //PESO LÍQUIDO
2519
        $x     += $w3;
2520
        $w     = $maxW - ($w1 + 3 * $w2 + $w3);
2521
        $texto = 'PESO LÍQUIDO';
2522
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2523
        $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...
2524
        if (is_numeric($pesoLiquido) && $pesoLiquido > 0) {
2525
            $texto = number_format($pesoLiquido, 3, ",", ".");
2526
        } else {
2527
            $texto = '';
2528
        }
2529
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2530
        $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...
2531
2532
        return ($y + $h);
2533
    } //fim transporte
2534
2535
2536
    protected function descricaoProdutoHelper($origem, $campo, $formato)
2537
    {
2538
        $valor_original = $origem->getElementsByTagName($campo)->item(0);
2539
        if (! isset($valor_original)) {
2540
            return "";
2541
        }
2542
        $valor_original = $valor_original->nodeValue;
2543
        $valor          = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2544
2545
        if ($valor != "") {
2546
            return sprintf($formato, $valor);
2547
        }
2548
2549
        return "";
2550
    }
2551
2552
    /**
2553
     * descricaoProduto
2554
     * Monta a string de descrição de cada Produto
2555
     *
2556
     * @name   descricaoProduto
2557
     *
2558
     * @param DOMNode itemProd
2559
     *
2560
     * @return string descricao do produto
2561
     */
2562
    protected function descricaoProduto($itemProd)
2563
    {
2564
        $prod       = $itemProd->getElementsByTagName('prod')->item(0);
2565
        $ICMS       = $itemProd->getElementsByTagName("ICMS")->item(0);
2566
        $ICMSUFDest = $itemProd->getElementsByTagName("ICMSUFDest")->item(0);
2567
        $impostos   = '';
2568
2569
        if (! empty($ICMS)) {
2570
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vBCFCP", " BcFcp=%s");
2571
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pFCP", " pFcp=%s%%");
2572
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vFCP", " vFcp=%s");
2573
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pRedBC", " pRedBC=%s%%");
2574
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pMVAST", " IVA/MVA=%s%%");
2575
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pICMSST", " pIcmsSt=%s%%");
2576
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vBCST", " BcIcmsSt=%s");
2577
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vICMSST", " vIcmsSt=%s");
2578
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vBCFCPST", " BcFcpSt=%s");
2579
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pFCPST", " pFcpSt=%s%%");
2580
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vFCPST", " vFcpSt=%s");
2581
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vBCSTRet", " Retido na compra: BASE ICMS ST=%s");
2582
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pST", " pSt=%s");
2583
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vICMSSTRet", " VALOR ICMS ST=%s");
2584
        }
2585
        if (! empty($ICMSUFDest)) {
2586
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "pFCPUFDest", " pFCPUFDest=%s%%");
2587
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "pICMSUFDest", " pICMSUFDest=%s%%");
2588
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "pICMSInterPart", " pICMSInterPart=%s%%");
2589
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vFCPUFDest", " vFCPUFDest=%s");
2590
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
2591
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
2592
        }
2593
        $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue)
2594
            ? substr(
2595
                $this->anfaveaDANFE($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue),
2596
                0,
2597
                500
2598
            )
2599
            : '';
2600
        if (! empty($infAdProd)) {
2601
            $infAdProd = trim($infAdProd);
2602
            $infAdProd .= ' ';
2603
        }
2604
        $loteTxt = '';
2605
        $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...
2606
        if (! empty($prod->getElementsByTagName("rastro"))) {
2607
            $rastro = $prod->getElementsByTagName("rastro");
2608
            $i      = 0;
2609
            while ($i < $rastro->length) {
2610
                $loteTxt .= $this->getTagValue($rastro->item($i), 'nLote', ' Lote: ');
2611
                $loteTxt .= $this->getTagValue($rastro->item($i), 'qLote', ' Quant: ');
2612
                $loteTxt .= $this->getTagDate($rastro->item($i), 'dFab', ' Fab: ');
2613
                $loteTxt .= $this->getTagDate($rastro->item($i), 'dVal', ' Val: ');
2614
                $loteTxt .= $this->getTagValue($rastro->item($i), 'vPMC', ' PMC: ');
2615
                $i ++;
2616
            }
2617
            if ($loteTxt != '') {
2618
                $loteTxt .= ' ';
2619
            }
2620
        }
2621
        //NT2013.006 FCI
2622
        $nFCI   = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2623
            ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2624
        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2625
        $texto  = $prod->getElementsByTagName("xProd")->item(0)->nodeValue
2626
            . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
2627
        //decodifica os caracteres html no xml
2628
        $texto = html_entity_decode($texto);
2629
        if ($this->descProdQuebraLinha) {
2630
            $texto = str_replace(";", "\n", $texto);
2631
        }
2632
2633
        return $texto;
2634
    }
2635
2636
    /**
2637
     * itens
2638
     * Monta o campo de itens da DANFE (retrato e paisagem)
2639
     *
2640
     * @name   itens
2641
     *
2642
     * @param float $x       Posição horizontal canto esquerdo
2643
     * @param float $y       Posição vertical canto superior
2644
     * @param float $nInicio Número do item inicial
2645
     * @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...
2646
     * @param float $hmax    Altura máxima do campo de itens em mm
2647
     *
2648
     * @return float Posição vertical final
2649
     */
2650
    protected function itens($x, $y, &$nInicio, $hmax, $pag = 0, $totpag = 0, $hCabecItens = 7)
2651
    {
2652
2653
        $oldX = $x;
2654
        $oldY = $y;
2655
        $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...
2656
        //#####################################################################
2657
        //DADOS DOS PRODUTOS / SERVIÇOS
2658
        $texto = "DADOS DOS PRODUTOS / SERVIÇOS";
2659
        if ($this->orientacao == 'P') {
2660
            $w = $this->wPrint;
2661
        } else {
2662
            if ($nInicio < 2) { // primeira página
2663
                $w = $this->wPrint - $this->wCanhoto;
2664
            } else { // páginas seguintes
2665
                $w = $this->wPrint;
2666
            }
2667
        }
2668
        $h     = 4;
2669
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2670
        $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...
2671
        $y += 3;
2672
        //desenha a caixa dos dados dos itens da NF
2673
        $hmax  += 1;
2674
        $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...
2675
        $this->pdf->textBox($x, $y, $w, $hmax);
2676
        //##################################################################################
2677
        // cabecalho LOOP COM OS DADOS DOS PRODUTOS
2678
        //CÓDIGO PRODUTO
2679
        $texto = "CÓDIGO PRODUTO";
2680
        $w1    = round($w * 0.09, 0);
2681
        $h     = 4;
2682
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2683
        $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...
2684
        $this->pdf->line($x + $w1, $y, $x + $w1, $y + $hmax);
2685
        //DESCRIÇÃO DO PRODUTO / SERVIÇO
2686
        $x     += $w1;
2687
        $w2    = round($w * 0.25, 0);
2688
        $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO';
2689
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2690
        $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...
2691
        $this->pdf->line($x + $w2, $y, $x + $w2, $y + $hmax);
2692
        //NCM/SH
2693
        $x     += $w2;
2694
        $w3    = round($w * 0.06, 0);
2695
        $texto = 'NCM/SH';
2696
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2697
        $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...
2698
        $this->pdf->line($x + $w3, $y, $x + $w3, $y + $hmax);
2699
        //O/CST ou O/CSOSN
2700
        $x     += $w3;
2701
        $w4    = round($w * 0.05, 0);
2702
        $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2703
        if ($this->getTagValue($this->emit, 'CRT') == '3') {
2704
            $texto = 'O/CST';//Regime Normal
2705
        }
2706
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2707
        $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...
2708
        $this->pdf->line($x + $w4, $y, $x + $w4, $y + $hmax);
2709
        //CFOP
2710
        $x     += $w4;
2711
        $w5    = round($w * 0.04, 0);
2712
        $texto = 'CFOP';
2713
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2714
        $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...
2715
        $this->pdf->line($x + $w5, $y, $x + $w5, $y + $hmax);
2716
        //UN
2717
        $x     += $w5;
2718
        $w6    = round($w * 0.03, 0);
2719
        $texto = 'UN';
2720
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2721
        $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...
2722
        $this->pdf->line($x + $w6, $y, $x + $w6, $y + $hmax);
2723
        //QUANT
2724
        $x     += $w6;
2725
        $w7    = round($w * 0.08, 0);
2726
        $texto = 'QUANT';
2727
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2728
        $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...
2729
        $this->pdf->line($x + $w7, $y, $x + $w7, $y + $hmax);
2730
        //VALOR UNIT
2731
        $x     += $w7;
2732
        $w8    = round($w * 0.06, 0);
2733
        $texto = 'VALOR UNIT';
2734
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2735
        $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...
2736
        $this->pdf->line($x + $w8, $y, $x + $w8, $y + $hmax);
2737
        //VALOR TOTAL
2738
        $x     += $w8;
2739
        $w9    = round($w * 0.06, 0);
2740
        $texto = 'VALOR TOTAL';
2741
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2742
        $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...
2743
        $this->pdf->line($x + $w9, $y, $x + $w9, $y + $hmax);
2744
        //VALOR DESCONTO
2745
        $x     += $w9;
2746
        $w10   = round($w * 0.05, 0);
2747
        $texto = 'VALOR DESC';
2748
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2749
        $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...
2750
        $this->pdf->line($x + $w10, $y, $x + $w10, $y + $hmax);
2751
        //B.CÁLC ICMS
2752
        $x     += $w10;
2753
        $w11   = round($w * 0.06, 0);
2754
        $texto = 'B.CÁLC ICMS';
2755
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2756
        $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...
2757
        $this->pdf->line($x + $w11, $y, $x + $w11, $y + $hmax);
2758
        //VALOR ICMS
2759
        $x     += $w11;
2760
        $w12   = round($w * 0.06, 0);
2761
        $texto = 'VALOR ICMS';
2762
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2763
        $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...
2764
        $this->pdf->line($x + $w12, $y, $x + $w12, $y + $hmax);
2765
        //VALOR IPI
2766
        $x     += $w12;
2767
        $w13   = round($w * 0.05, 0);
2768
        $texto = 'VALOR IPI';
2769
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2770
        $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...
2771
        $this->pdf->line($x + $w13, $y, $x + $w13, $y + $hmax);
2772
        //ALÍQ. ICMS
2773
        $x     += $w13;
2774
        $w14   = round($w * 0.04, 0);
2775
        $texto = 'ALÍQ. ICMS';
2776
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2777
        $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...
2778
        $this->pdf->line($x + $w14, $y, $x + $w14, $y + $hmax);
2779
        //ALÍQ. IPI
2780
        $x     += $w14;
2781
        $w15   = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13 + $w14);
2782
        $texto = 'ALÍQ. IPI';
2783
        $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...
2784
        $this->pdf->line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1);
2785
        $y += 5;
2786
        //##################################################################################
2787
        // LOOP COM OS DADOS DOS PRODUTOS
2788
        $i      = 0;
2789
        $hUsado = $hCabecItens;
2790
        $aFont  = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
2791
2792
        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...
2793
            if ($i >= $nInicio) {
2794
                $thisItem = $this->det->item($i);
2795
                //carrega as tags do item
2796
                $prod         = $thisItem->getElementsByTagName("prod")->item(0);
2797
                $imposto      = $this->det->item($i)->getElementsByTagName("imposto")->item(0);
2798
                $ICMS         = $imposto->getElementsByTagName("ICMS")->item(0);
2799
                $IPI          = $imposto->getElementsByTagName("IPI")->item(0);
2800
                $textoProduto = $this->descricaoProduto($thisItem);
2801
2802
                // Posição y dos dados das unidades tributaveis.
2803
                $yTrib = $this->pdf->fontSize + .5;
2804
                if (! $this->mostrarUnidadeTributavel) {
2805
                    $yTrib = 0;
2806
                }
2807
                $h      = $this->calculeHeight($thisItem);
2808
                $hUsado += $h;
2809
2810
                $yTrib += $y;
2811
                $diffH = $hmax - $hUsado;
2812
2813
                if ($pag != $totpag) {
2814
                    if (1 > $diffH && $i < $totItens) {
2815
                        //ultrapassa a capacidade para uma única página
2816
                        //o restante dos dados serão usados nas proximas paginas
2817
                        $nInicio = $i;
2818
                        break;
2819
                    }
2820
                }
2821
                $y_linha = $y + $h;
2822
                // linha entre itens
2823
                $this->pdf->dashedHLine($oldX, $y_linha, $w, 0.1, 120);
2824
                //corrige o x
2825
                $x = $oldX;
2826
                //codigo do produto
2827
                $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...
2828
                $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue;
2829
                $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...
2830
                $x += $w1;
2831
                //DESCRIÇÃO
2832
                if ($this->orientacao == 'P') {
2833
                    $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...
2834
                } else {
2835
                    $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...
2836
                }
2837
                $x += $w2;
2838
                //NCM
2839
                $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2840
                    $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';
2841
                $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...
2842
                $x += $w3;
2843
                //CST
2844
                if (isset($ICMS)) {
2845
                    $origem = $this->getTagValue($ICMS, "orig");
2846
                    $cst    = $this->getTagValue($ICMS, "CST");
2847
                    $csosn  = $this->getTagValue($ICMS, "CSOSN");
2848
                    $texto  = $origem . $cst . $csosn;
2849
                    $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...
2850
                }
2851
                //CFOP
2852
                $x     += $w4;
2853
                $texto = $prod->getElementsByTagName("CFOP")->item(0)->nodeValue;
2854
                $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...
2855
                //Unidade
2856
                $x     += $w5;
2857
                $texto = $prod->getElementsByTagName("uCom")->item(0)->nodeValue;
2858
                $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...
2859
                //Unidade de medida tributável
2860
                if ($this->mostrarUnidadeTributavel) {
2861
                    $uTrib = $prod->getElementsByTagName("uTrib")->item(0);
2862
                    if (! empty($uTrib)) {
2863
                        $texto = $uTrib->nodeValue;
2864
                        $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...
2865
                    }
2866
                }
2867
                $x += $w6;
2868
                if ($this->orientacao == 'P') {
2869
                    $alinhamento = 'R';
2870
                } else {
2871
                    $alinhamento = 'R';
2872
                }
2873
                // QTDADE
2874
                $qCom  = $prod->getElementsByTagName("qCom")->item(0);
2875
                $texto = number_format($qCom->nodeValue, $this->qComCasasDec, ",", ".");
2876
                $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...
2877
                // QTDADE Tributável
2878
                if ($this->mostrarUnidadeTributavel) {
2879
                    $qTrib = $prod->getElementsByTagName("qTrib")->item(0);
2880
                    if (! empty($qTrib)) {
2881
                        $texto = number_format($qTrib->nodeValue, $this->qComCasasDec, ",", ".");
2882
                        $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...
2883
                    }
2884
                }
2885
                $x += $w7;
2886
                // Valor Unitário
2887
                $vUnCom = $prod->getElementsByTagName("vUnCom")->item(0);
2888
                $texto  = number_format($vUnCom->nodeValue, $this->vUnComCasasDec, ",", ".");
2889
                $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...
2890
                // Valor Unitário Tributável
2891
                if ($this->mostrarUnidadeTributavel) {
2892
                    $vUnTrib = $prod->getElementsByTagName("vUnTrib")->item(0);
2893
                    if (! empty($vUnTrib)) {
2894
                        $texto = number_format($vUnTrib->nodeValue, $this->vUnComCasasDec, ",", ".");
2895
                        $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...
2896
                    }
2897
                }
2898
                $x += $w8;
2899
                // Valor do Produto
2900
                $texto = "";
2901
                if (is_numeric($prod->getElementsByTagName("vProd")->item(0)->nodeValue)) {
2902
                    $texto = number_format($prod->getElementsByTagName("vProd")->item(0)->nodeValue, 2, ",", ".");
2903
                }
2904
                $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...
2905
                $x += $w9;
2906
                //Valor do Desconto
2907
                $vdesc = ! empty($prod->getElementsByTagName("vDesc")->item(0)->nodeValue)
2908
                    ? $prod->getElementsByTagName("vDesc")->item(0)->nodeValue : 0;
2909
2910
                $texto = number_format($vdesc, 2, ",", ".");
2911
                $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...
2912
                //Valor da Base de calculo
2913
                $x += $w10;
2914
                if (isset($ICMS)) {
2915
                    $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue)
2916
                        ? number_format(
2917
                            $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue,
2918
                            2,
2919
                            ",",
2920
                            "."
2921
                        )
2922
                        : '0,00';
2923
                    $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...
2924
                }
2925
                //Valor do ICMS
2926
                $x += $w11;
2927
                if (isset($ICMS)) {
2928
                    $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue)
2929
                        ? number_format(
2930
                            $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue,
2931
                            2,
2932
                            ",",
2933
                            "."
2934
                        )
2935
                        : '0,00';
2936
                    $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...
2937
                }
2938
                //Valor do IPI
2939
                $x += $w12;
2940
                if (isset($IPI)) {
2941
                    $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue)
2942
                        ? number_format(
2943
                            $IPI->getElementsByTagName("vIPI")->item(0)->nodeValue,
2944
                            2,
2945
                            ",",
2946
                            "."
2947
                        )
2948
                        : '';
2949
                } else {
2950
                    $texto = '';
2951
                }
2952
                $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...
2953
                // %ICMS
2954
                $x += $w13;
2955
                if (isset($ICMS)) {
2956
                    $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue)
2957
                        ? number_format(
2958
                            $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue,
2959
                            2,
2960
                            ",",
2961
                            "."
2962
                        )
2963
                        : '0,00';
2964
                    $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...
2965
                }
2966
                //%IPI
2967
                $x += $w14;
2968
                if (isset($IPI)) {
2969
                    $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue)
2970
                        ? number_format(
2971
                            $IPI->getElementsByTagName("pIPI")->item(0)->nodeValue,
2972
                            2,
2973
                            ",",
2974
                            "."
2975
                        )
2976
                        : '';
2977
                } else {
2978
                    $texto = '';
2979
                }
2980
                $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...
2981
2982
2983
                // Dados do Veiculo Somente para veiculo 0 Km
2984
                $veicProd = $prod->getElementsByTagName("veicProd")->item(0);
2985
                // Tag somente é gerada para veiculo 0k, e só é permitido um veiculo por NF-e por conta do detran
2986
                // Verifica se a Tag existe
2987
                if (! empty($veicProd)) {
2988
                    $this->dadosItenVeiculoDANFE($oldX, $y, $nInicio, $h, $prod);
2989
                }
2990
2991
2992
                $y += $h;
2993
                $i ++;
2994
                //incrementa o controle dos itens processados.
2995
                $this->qtdeItensProc ++;
2996
            } else {
2997
                $i ++;
2998
            }
2999
        }
3000
3001
        return $oldY + $hmax;
3002
    }
3003
3004
3005
    /**
3006
     * dadosItenVeiculoDANFE
3007
     * Coloca os dados do veiculo abaixo do item da NFe. (retrato e paisagem)
3008
     *
3009
     * @param float  $x    Posição horizontal
3010
     *                     canto esquerdo
3011
     * @param float  $y    Posição vertical
3012
     *                     canto superior
3013
     * @param        $nInicio
3014
     * @param float  $h    altura do campo
3015
     * @param object $prod Contendo todos os dados do item
3016
     */
3017
3018
    protected function dadosItenVeiculoDANFE($x, $y, &$nInicio, $h, $prod)
3019
    {
3020
        $oldX = $x;
3021
        $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...
3022
3023
        if ($this->orientacao == 'P') {
3024
            $w = $this->wPrint;
3025
        } else {
3026
            if ($nInicio < 2) { // primeira página
3027
                $w = $this->wPrint - $this->wCanhoto;
3028
            } else { // páginas seguintes
3029
                $w = $this->wPrint;
3030
            }
3031
        }
3032
3033
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
3034
3035
        $w1 = round($w * 0.09, 0);
3036
3037
        // Tabela Renavam Combustivel
3038
        $renavamCombustivel = [
3039
            1  => 'ALCOOL',
3040
            2  => 'GASOLINA',
3041
            3  => 'DIESEL',
3042
            4  => 'GASOGENIO',
3043
            5  => 'GAS METANO',
3044
            6  => 'ELETRICO/FONTE INTERNA',
3045
            7  => 'ELETRICO/FONTE EXTERNA',
3046
            8  => 'GASOL/GAS NATURAL COMBUSTIVEL',
3047
            9  => 'ALCOOL/GAS NATURAL COMBUSTIVEL',
3048
            10 => 'DIESEL/GAS NATURAL COMBUSTIVEL',
3049
            11 => 'VIDE/CAMPO/OBSERVACAO',
3050
            12 => 'ALCOOL/GAS NATURAL VEICULAR',
3051
            13 => 'GASOLINA/GAS NATURAL VEICULAR',
3052
            14 => 'DIESEL/GAS NATURAL VEICULAR',
3053
            15 => 'GAS NATURAL VEICULAR',
3054
            16 => 'ALCOOL/GASOLINA',
3055
            17 => 'GASOLINA/ALCOOL/GAS NATURAL',
3056
            18 => 'GASOLINA/ELETRICO'
3057
        ];
3058
3059
        $renavamEspecie = [
3060
            1 => 'PASSAGEIRO',
3061
            2 => 'CARGA',
3062
            3 => 'MISTO',
3063
            4 => 'CORRIDA',
3064
            5 => 'TRACAO',
3065
            6 => 'ESPECIAL',
3066
            7 => 'COLECAO'
3067
        ];
3068
3069
        $renavamTiposVeiculos = [
3070
            1  => 'BICICLETA',
3071
            2  => 'CICLOMOTOR',
3072
            3  => 'MOTONETA',
3073
            4  => 'MOTOCICLETA',
3074
            5  => 'TRICICLO',
3075
            6  => 'AUTOMOVEL',
3076
            7  => 'MICROONIBUS',
3077
            8  => 'ONIBUS',
3078
            9  => 'BONDE',
3079
            10 => 'REBOQUE',
3080
            11 => 'SEMI-REBOQUE',
3081
            12 => 'CHARRETE',
3082
            13 => 'CAMIONETA',
3083
            14 => 'CAMINHAO',
3084
            15 => 'CARROCA',
3085
            16 => 'CARRO DE MAO',
3086
            17 => 'CAMINHAO TRATOR',
3087
            18 => 'TRATOR DE RODAS',
3088
            19 => 'TRATOR DE ESTEIRAS',
3089
            20 => 'TRATOR MISTO',
3090
            21 => 'QUADRICICLO',
3091
            22 => 'CHASSI/PLATAFORMA',
3092
            23 => 'CAMINHONETE',
3093
            24 => 'SIDE-CAR',
3094
            25 => 'UTILITARIO',
3095
            26 => 'MOTOR-CASA'
3096
        ];
3097
3098
        $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...
3099
            'F' => 'FOSCA',
3100
            'S' => 'SÓLIDA',
3101
            'P' => 'PEROLIZADA',
3102
            'M' => 'METALICA',
3103
        ];
3104
3105
        $veicProd = $prod->getElementsByTagName("veicProd")->item(0);
3106
3107
        $veiculoChassi     = $veicProd->getElementsByTagName("chassi")->item(0)->nodeValue;
3108
        $veiculoCor        = $veicProd->getElementsByTagName("xCor")->item(0)->nodeValue;
3109
        $veiculoCilindrada = $veicProd->getElementsByTagName("cilin")->item(0)->nodeValue;
3110
        $veiculoCmkg       = $veicProd->getElementsByTagName("CMT")->item(0)->nodeValue;
3111
        $veiculoTipo       = $veicProd->getElementsByTagName("tpVeic")->item(0)->nodeValue;
3112
3113
        $veiculoMotor       = $veicProd->getElementsByTagName("nMotor")->item(0)->nodeValue;
3114
        $veiculoRenavam     = $veicProd->getElementsByTagName("cMod")->item(0)->nodeValue;
3115
        $veiculoHp          = $veicProd->getElementsByTagName("pot")->item(0)->nodeValue;
3116
        $veiculoPlaca       = ''; //$veiculo->getElementsByTagName("CMT")->item(0)->nodeValue;
3117
        $veiculoTipoPintura = $veicProd->getElementsByTagName("tpPint")->item(0)->nodeValue;
3118
        $veiculoMarcaModelo = $prod->getElementsByTagName("xProd")->item(0)->nodeValue;
3119
        $veiculoEspecie     = $veicProd->getElementsByTagName("espVeic")->item(0)->nodeValue;
3120
        $veiculoCombustivel = $veicProd->getElementsByTagName("tpComb")->item(0)->nodeValue;
3121
        $veiculoSerial      = $veicProd->getElementsByTagName("nSerie")->item(0)->nodeValue;
3122
        $veiculoFabricacao  = $veicProd->getElementsByTagName("anoFab")->item(0)->nodeValue;
3123
        $veiculoModelo      = $veicProd->getElementsByTagName("anoMod")->item(0)->nodeValue;
3124
        $veiculoDistancia   = $veicProd->getElementsByTagName("dist")->item(0)->nodeValue;
3125
3126
        $x = $oldX;
3127
3128
        $yVeic = $y + $h;
3129
        $texto = 'Chassi: ............: ' . $veiculoChassi;
3130
        $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...
3131
        $yVeic += $h;
3132
        $texto = 'Cor...................: ' . $veiculoCor;
3133
        $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...
3134
        $yVeic += $h;
3135
        $texto = 'Cilindrada........: ' . $veiculoCilindrada;
3136
        $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...
3137
        $yVeic += $h;
3138
        $texto = 'Cmkg...............: ' . $veiculoCmkg;
3139
        $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...
3140
        $yVeic += $h;
3141
        $texto = 'Tipo.................: ' . ($renavamTiposVeiculos[intval($veiculoTipo)] ?? $veiculoTipo);
3142
        $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...
3143
        $yVeic = $y + $h;
3144
        $xVeic = $x + 65;
3145
        $texto = 'Nº Motor: .........: ' . $veiculoMotor;
3146
        $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...
3147
        $yVeic += $h;
3148
        $texto = 'Renavam...........: ' . $veiculoRenavam;
3149
        $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...
3150
        $yVeic += $h;
3151
        $texto = 'HP.....................: ' . $veiculoHp;
3152
        $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...
3153
        $yVeic += $h;
3154
        $texto = 'Placa.................: ' . $veiculoPlaca;
3155
        $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...
3156
        $yVeic += $h;
3157
        $texto = 'Tipo Pintura......: ' . ($renavamEspecie[intval($veiculoTipoPintura)] ?? $veiculoTipoPintura);
3158
        $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...
3159
        $yVeic = $y + $h;
3160
        $xVeic = $xVeic + 55;
3161
        $texto = 'Marca / Modelo.....: ' . $veiculoMarcaModelo;
3162
        $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...
3163
        $yVeic += $h;
3164
        $texto = 'Especie..................: ' . ($renavamEspecie[intval($veiculoEspecie)] ?? $veiculoEspecie);
3165
        $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...
3166
        $yVeic += $h;
3167
        $texto = 'Combustivel..........: ' . ($renavamCombustivel[intval($veiculoCombustivel)] ?? $veiculoCombustivel);
3168
        $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...
3169
        $yVeic += $h;
3170
        $texto = 'Serial.....................: ' . $veiculoSerial;
3171
        $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...
3172
        $yVeic += $h;
3173
        $texto = 'Ano Fab/Mod........: ' . $veiculoFabricacao . '/' . $veiculoModelo;
3174
        $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...
3175
        $yVeic += $h;
3176
        $texto = 'Distancia Entre Eixos(mm)..: ' . $veiculoDistancia;
3177
        $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...
3178
    }
3179
3180
    /**
3181
     * issqn
3182
     * Monta o campo de serviços do DANFE
3183
     *
3184
     * @name   issqn (retrato e paisagem)
3185
     *
3186
     * @param float $x Posição horizontal canto esquerdo
3187
     * @param float $y Posição vertical canto superior
3188
     *
3189
     * @return float Posição vertical final
3190
     */
3191
    protected function issqn($x, $y)
3192
    {
3193
        $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...
3194
        //#####################################################################
3195
        //CÁLCULO DO ISSQN
3196
        $texto = "CÁLCULO DO ISSQN";
3197
        $w     = $this->wPrint;
3198
        $h     = 7;
3199
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
3200
        $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...
3201
        //INSCRIÇÃO MUNICIPAL
3202
        $y     += 3;
3203
        $w     = round($this->wPrint * 0.23, 0);
3204
        $texto = 'INSCRIÇÃO MUNICIPAL';
3205
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3206
        $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...
3207
        //inscrição municipal
3208
        $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
3209
            $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : '';
3210
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
3211
        $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...
3212
        //VALOR TOTAL DOS SERVIÇOS
3213
        $x     += $w;
3214
        $texto = 'VALOR TOTAL DOS SERVIÇOS';
3215
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3216
        $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...
3217
        if (isset($this->ISSQNtot)) {
3218
            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
3219
                $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : '';
3220
            $texto = number_format($texto, 2, ",", ".");
3221
        } else {
3222
            $texto = '';
3223
        }
3224
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
3225
        $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...
3226
        //BASE DE CÁLCULO DO ISSQN
3227
        $x     += $w;
3228
        $texto = 'BASE DE CÁLCULO DO ISSQN';
3229
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3230
        $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...
3231
        if (isset($this->ISSQNtot)) {
3232
            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
3233
                $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : '';
3234
            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
3235
        } else {
3236
            $texto = '';
3237
        }
3238
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
3239
        $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...
3240
        //VALOR TOTAL DO ISSQN
3241
        $x += $w;
3242
        if ($this->orientacao == 'P') {
3243
            $w = $this->wPrint - (3 * $w);
3244
        } else {
3245
            $w = $this->wPrint - (3 * $w) - $this->wCanhoto;
3246
        }
3247
        $texto = 'VALOR TOTAL DO ISSQN';
3248
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3249
        $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...
3250
        if (isset($this->ISSQNtot)) {
3251
            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
3252
                $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : '';
3253
            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
3254
        } else {
3255
            $texto = '';
3256
        }
3257
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
3258
        $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...
3259
3260
        return ($y + $h + 1);
3261
    }
3262
3263
    /**
3264
     *dadosAdicionais
3265
     * Coloca o grupo de dados adicionais da NFe. (retrato e paisagem)
3266
     *
3267
     * @name   dadosAdicionais
3268
     *
3269
     * @param float $x Posição horizontal canto esquerdo
3270
     * @param float $y Posição vertical canto superior
3271
     * @param float $h altura do campo
3272
     *
3273
     * @return float Posição vertical final (eixo Y)
3274
     */
3275
    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...
3276
    {
3277
        $y = $this->maxH - (7 + $h);
3278
        //$y = $this->maxH - 20;
3279
        //##################################################################################
3280
        //DADOS ADICIONAIS
3281
        $texto = "DADOS ADICIONAIS";
3282
        if ($this->orientacao == 'P') {
3283
            $w = $this->wPrint;
3284
        } else {
3285
            $w = $this->wPrint - $this->wCanhoto;
3286
        }
3287
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
3288
        $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...
3289
3290
        //INFORMAÇÕES COMPLEMENTARES
3291
        $texto = "INFORMAÇÕES COMPLEMENTARES";
3292
        $y     += 3;
3293
        $w     = $this->wAdic;
3294
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'B'];
3295
        $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...
3296
        //o texto com os dados adicionais foi obtido na função montaDANFE
3297
        //e carregado em uma propriedade privada da classe
3298
        //$this->wAdic com a largura do campo
3299
        //$this->textoAdic com o texto completo do campo
3300
        //echo str_replace("\n", "<br>",$this->textoAdic);
3301
        //die;
3302
        $y     += 1;
3303
        $aFont = ['font' => $this->fontePadrao, 'size' => $this->textadicfontsize * $this->pdf->k, 'style' => ''];
3304
        //$aFont = ['font'=>$this->fontePadrao, 'size'=> 5, 'style'=>''];
3305
        $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...
3306
        //RESERVADO AO FISCO
3307
        $texto = "RESERVADO AO FISCO";
3308
        if (isset($this->nfeProc) && $this->nfeProc->getElementsByTagName("xMsg")->length) {
3309
            $texto = $texto . ' ' . $this->nfeProc->getElementsByTagName("xMsg")->item(0)->nodeValue;
3310
        }
3311
        $x += $w;
3312
        $y -= 1;
3313
        if ($this->orientacao == 'P') {
3314
            $w = $this->wPrint - $w;
3315
        } else {
3316
            $w = $this->wPrint - $w - $this->wCanhoto;
3317
        }
3318
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'B'];
3319
        $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...
3320
        //inserir texto informando caso de contingência
3321
        // 1 - Normal - emissão normal;
3322
        // 2 - Contingência FS - emissão em contingência com impressão do DANFE em Formulário de Segurança;
3323
        // 3 - Contingência SCAN - emissão em contingência no Sistema de Contingência do Ambiente Nacional;
3324
        // 4 - Contingência DPEC - emissão em contingência com envio da Declaração
3325
        //     Prévia de Emissão em Contingência;
3326
        // 5 - Contingência FS-DA - emissão em contingência com impressão do DANFE em Formulário de
3327
        //     Segurança para Impressão de Documento Auxiliar de Documento Fiscal Eletrônico (FS-DA);
3328
        // 6 - Contingência SVC-AN
3329
        // 7 - Contingência SVC-RS
3330
        $xJust  = $this->getTagValue($this->ide, 'xJust', 'Justificativa: ');
3331
        $dhCont = $this->getTagValue($this->ide, 'dhCont', ' Entrada em contingência : ');
3332
        $texto  = '';
3333
        switch ($this->tpEmis) {
3334
            case 2:
3335
                $texto = 'CONTINGÊNCIA FS' . $dhCont . $xJust;
3336
                break;
3337
            case 3:
3338
                $texto = 'CONTINGÊNCIA SCAN' . $dhCont . $xJust;
3339
                break;
3340
            case 4:
3341
                $texto = 'CONTINGÊNCIA DPEC' . $dhCont . $xJust;
3342
                break;
3343
            case 5:
3344
                $texto = 'CONTINGÊNCIA FSDA' . $dhCont . $xJust;
3345
                break;
3346
            case 6:
3347
                $texto = 'CONTINGÊNCIA SVC-AN' . $dhCont . $xJust;
3348
                break;
3349
            case 7:
3350
                $texto = 'CONTINGÊNCIA SVC-RS' . $dhCont . $xJust;
3351
                break;
3352
        }
3353
        $y     += 2;
3354
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
3355
        $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...
3356
3357
        return $y + $h;
3358
    }
3359
3360
    /**
3361
     * rodape
3362
     * Monta o rodapé no final da DANFE com a data/hora de impressão e informações
3363
     * sobre a API NfePHP
3364
     *
3365
     * @param float $x Posição horizontal canto esquerdo
3366
     *
3367
     * @return void
3368
     */
3369
    protected function rodape($x)
3370
    {
3371
        $y = $this->maxH - 4;
3372
        if ($this->orientacao == 'P') {
3373
            $w = $this->wPrint;
3374
        } else {
3375
            $w = $this->wPrint - $this->wCanhoto;
3376
            $x = $this->wCanhoto;
3377
        }
3378
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I'];
3379
        $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s')
3380
            . '  ' . $this->creditos;
3381
        $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false);
3382
        $texto = $this->powered ? "Powered by NFePHP®" : '';
3383
        $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'R', false, '');
3384
    }
3385
3386
    /**
3387
     * Monta o canhoto da DANFE (retrato e paisagem)
3388
     *
3389
     * @name   canhotoDANFE
3390
     *
3391
     * @param number $x Posição horizontal canto esquerdo
3392
     * @param number $y Posição vertical canto superior
3393
     *
3394
     * @return number Posição vertical final
3395
     *
3396
     * TODO 21/07/14 fmertins: quando orientação L-paisagem, o canhoto está sendo gerado incorretamente
3397
     */
3398
    protected function canhoto($x, $y)
3399
    {
3400
        $oldX = $x;
3401
        $oldY = $y;
3402
        //#################################################################################
3403
        //canhoto
3404
        //identificação do tipo de nf entrada ou saida
3405
        $tpNF = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
3406
        if ($tpNF == '0') {
3407
            //NFe de Entrada
3408
            $emitente     = '';
3409
            $emitente     .= $this->dest->getElementsByTagName("xNome")->item(0)->nodeValue . " - ";
3410
            $emitente     .= $this->enderDest->getElementsByTagName("xLgr")->item(0)->nodeValue . ", ";
3411
            $emitente     .= $this->enderDest->getElementsByTagName("nro")->item(0)->nodeValue . " - ";
3412
            $emitente     .= $this->getTagValue($this->enderDest, "xCpl", " - ", " ");
3413
            $emitente     .= $this->enderDest->getElementsByTagName("xBairro")->item(0)->nodeValue . " ";
3414
            $emitente     .= $this->enderDest->getElementsByTagName("xMun")->item(0)->nodeValue . "-";
3415
            $emitente     .= $this->enderDest->getElementsByTagName("UF")->item(0)->nodeValue . "";
3416
            $destinatario = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue . " ";
3417
        } else {
3418
            //NFe de Saída
3419
            $emitente     = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue . " ";
3420
            $destinatario = '';
3421
            $destinatario .= $this->dest->getElementsByTagName("xNome")->item(0)->nodeValue . " - ";
3422
            $destinatario .= $this->enderDest->getElementsByTagName("xLgr")->item(0)->nodeValue . ", ";
3423
            $destinatario .= $this->enderDest->getElementsByTagName("nro")->item(0)->nodeValue . " ";
3424
            $destinatario .= $this->getTagValue($this->enderDest, "xCpl", " - ", " ");
3425
            $destinatario .= $this->enderDest->getElementsByTagName("xBairro")->item(0)->nodeValue . " ";
3426
            $destinatario .= $this->enderDest->getElementsByTagName("xMun")->item(0)->nodeValue . "-";
3427
            $destinatario .= $this->enderDest->getElementsByTagName("UF")->item(0)->nodeValue . " ";
3428
        }
3429
        //identificação do sistema emissor
3430
        //linha separadora do canhoto
3431
        if ($this->orientacao == 'P') {
3432
            $w = round($this->wPrint * 0.81, 0);
3433
        } else {
3434
            //linha separadora do canhoto - 238
3435
            //posicao altura
3436
            $y = $this->wPrint - 85;
3437
            //altura
3438
            $w = $this->wPrint - 85 - 24;
3439
        }
3440
        $h = 10;
3441
        //desenha caixa
3442
        $texto      = '';
3443
        $aFont      = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
3444
        $aFontSmall = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3445
        if ($this->orientacao == 'P') {
3446
            $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...
3447
        } else {
3448
            $this->pdf->textBox90($x, $y, $w, $h, $texto, $aFont, 'C', 'L', 1, '', false);
3449
        }
3450
        $numNF = str_pad($this->ide->getElementsByTagName('nNF')->item(0)->nodeValue, 9, "0", STR_PAD_LEFT);
3451
        $serie = str_pad($this->ide->getElementsByTagName('serie')->item(0)->nodeValue, 3, "0", STR_PAD_LEFT);
3452
        $texto = "RECEBEMOS DE ";
3453
        $texto .= $emitente;
3454
        $texto .= " OS PRODUTOS E/OU SERVIÇOS CONSTANTES DA NOTA FISCAL ELETRÔNICA INDICADA ";
3455
        if ($this->orientacao == 'P') {
3456
            $texto .= "ABAIXO";
3457
        } else {
3458
            $texto .= "AO LADO";
3459
        }
3460
        $texto .= ". EMISSÃO: ";
3461
        $dEmi  = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3462
            $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3463
        if ($dEmi == '') {
3464
            $dEmi  = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3465
                $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3466
            $aDemi = explode('T', $dEmi);
3467
            $dEmi  = $aDemi[0];
3468
        }
3469
        $texto .= $this->ymdTodmy($dEmi) . " ";
3470
        $texto .= "VALOR TOTAL: R$ ";
3471
        $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " ";
3472
        $texto .= "DESTINATÁRIO: ";
3473
        $texto .= $destinatario;
3474
        if ($this->orientacao == 'P') {
3475
            $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...
3476
            $x1    = $x + $w;
3477
            $w1    = $this->wPrint - $w;
3478
            $texto = "NF-e";
3479
            $aFont = ['font' => $this->fontePadrao, 'size' => 14, 'style' => 'B'];
3480
            $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...
3481
            $texto = "Nº. " . $this->formatField($numNF, "###.###.###") . " \n";
3482
            $texto .= "Série $serie";
3483
            $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
3484
            $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...
3485
            //DATA DE RECEBIMENTO
3486
            $texto = "DATA DE RECEBIMENTO";
3487
            $y     += $h;
3488
            $w2    = round($this->wPrint * 0.17, 0); //35;
3489
            $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3490
            $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...
3491
            //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3492
            $x     += $w2;
3493
            $w3    = $w - $w2;
3494
            $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3495
            $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...
3496
            $x = $oldX;
3497
            $y += 9;
3498
            $this->pdf->dashedHLine($x, $y, $this->wPrint, 0.1, 80);
3499
            $y += 2;
3500
3501
            return $y;
3502
        } else {
3503
            $x --;
3504
            $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...
3505
            //NUMERO DA NOTA FISCAL LOGO NFE
3506
            $w1    = 18;
3507
            $x1    = $oldX;
3508
            $y     = $oldY;
3509
            $texto = "NF-e";
3510
            $aFont = ['font' => $this->fontePadrao, 'size' => 14, 'style' => 'B'];
3511
            $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...
3512
            $texto = "Nº.\n" . $this->formatField($numNF, "###.###.###") . " \n";
3513
            $texto .= "Série $serie";
3514
            $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
3515
            $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...
3516
            //DATA DO RECEBIMENTO
3517
            $texto = "DATA DO RECEBIMENTO";
3518
            $y     = $this->wPrint - 85;
3519
            $x     = 12;
3520
            $w2    = round($this->wPrint * 0.17, 0); //35;
3521
            $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3522
            $this->pdf->textBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3523
            //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3524
            $y     -= $w2;
3525
            $w3    = $w - $w2;
3526
            $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3527
            $aFont = ['font' => $this->fontePadrao, 'size' => 5.7, 'style' => ''];
3528
            $x     = $this->pdf->textBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3529
            $this->pdf->dashedVLine(22, $oldY, 0.1, $this->wPrint, 69);
3530
3531
            return $x;
3532
        }
3533
    }
3534
3535
    /**
3536
     * geraInformacoesDaTagCompra
3537
     * Devolve uma string contendo informação sobre as tag <compra><xNEmp>, <xPed> e <xCont> ou string vazia.
3538
     * Aviso: Esta função não leva em consideração dados na tag xPed do item.
3539
     *
3540
     * @name   pGeraInformacoesDaTagCompra
3541
     * @return string com as informacoes dos pedidos.
3542
     */
3543
    protected function geraInformacoesDaTagCompra()
3544
    {
3545
        if (! $this->gerarInformacoesAutomaticas) {
3546
            return '';
3547
        }
3548
        $saida = "";
3549
        if (isset($this->compra)) {
3550
            if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3551
                $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue;
3552
            }
3553
            if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3554
                $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue;
3555
            }
3556
            if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3557
                $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue;
3558
            }
3559
        }
3560
3561
        return $saida;
3562
    }
3563
3564
    /**
3565
     * geraChaveAdicionalDeContingencia
3566
     *
3567
     * @name   geraChaveAdicionalDeContingencia
3568
     * @return string chave
3569
     */
3570
    protected function geraChaveAdicionalDeContingencia()
3571
    {
3572
        //cUF tpEmis CNPJ vNF ICMSp ICMSs DD  DV
3573
        // Quantidade de caracteres  02   01      14  14    01    01  02 01
3574
        $forma = "%02d%d%s%014d%01d%01d%02d";
3575
        $cUF   = $this->ide->getElementsByTagName('cUF')->item(0)->nodeValue;
3576
        $CNPJ  = "00000000000000" . $this->emit->getElementsByTagName('CNPJ')->item(0)->nodeValue;
3577
        $CNPJ  = substr($CNPJ, - 14);
3578
        $vNF   = $this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue * 100;
3579
        $vICMS = $this->ICMSTot->getElementsByTagName("vICMS")->item(0)->nodeValue;
3580
        if ($vICMS > 0) {
3581
            $vICMS = 1;
3582
        }
3583
        $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3584
        if ($icmss > 0) {
3585
            $icmss = 1;
3586
        }
3587
        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3588
            $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3589
        if ($dEmi == '') {
3590
            $dEmi  = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3591
                $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3592
            $aDemi = explode('T', $dEmi);
3593
            $dEmi  = $aDemi[0];
3594
        }
3595
        $dd    = $dEmi;
3596
        $rpos  = strrpos($dd, '-');
3597
        $dd    = substr($dd, $rpos + 1);
3598
        $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd);
3599
        $chave = $chave . $this->modulo11($chave);
3600
3601
        return $chave;
3602
    }
3603
3604
    /**
3605
     *  geraInformacoesDasNotasReferenciadas
3606
     * Devolve uma string contendo informação sobre as notas referenciadas. Suporta N notas, eletrônicas ou não
3607
     * Exemplo: NFe Ref.: série: 01 número: 01 emit: 11.111.111/0001-01
3608
     * em 10/2010 [0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000]
3609
     *
3610
     * @return string Informacoes a serem adicionadas no rodapé sobre notas referenciadas.
3611
     */
3612
    protected function geraInformacoesDasNotasReferenciadas()
3613
    {
3614
        if (! $this->gerarInformacoesAutomaticas) {
3615
            return '';
3616
        }
3617
        $formaNfeRef = "\r\nNFe Ref.: série:%d número:%d emit:%s em %s [%s]";
3618
        $formaCTeRef = "\r\nCTe Ref.: série:%d número:%d emit:%s em %s [%s]";
3619
        $formaNfRef  = "\r\nNF  Ref.: série:%d numero:%d emit:%s em %s modelo: %d";
3620
        $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d";
3621
        $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s";
3622
        $saida       = '';
3623
        $nfRefs      = $this->ide->getElementsByTagName('NFref');
3624
        if (0 === $nfRefs->length) {
3625
            return $saida;
3626
        }
3627
        if ($nfRefs->length > 2) {
3628
            return 'Existem mais de 2 NF/NFe/ECF/NFP/CTe referenciadas, não serão exibidas na DANFE.';
3629
        }
3630
        foreach ($nfRefs as $nfRef) {
3631
            if (empty($nfRef)) {
3632
                continue;
3633
            }
3634
            $refNFe = $nfRef->getElementsByTagName('refNFe');
3635
            foreach ($refNFe as $chave_acessoRef) {
3636
                $chave_acesso  = $chave_acessoRef->nodeValue;
3637
                $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3638
                $data          = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3639
                $cnpj          = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3640
                $serie         = substr($chave_acesso, 22, 3);
3641
                $numero        = substr($chave_acesso, 25, 9);
3642
                $saida         .= sprintf($formaNfeRef, $serie, $numero, $cnpj, $data, $chave_acessoF);
3643
            }
3644
            $refNF = $nfRef->getElementsByTagName('refNF');
3645
            foreach ($refNF as $umaRefNFe) {
3646
                $data   = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3647
                $cnpj   = $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue;
3648
                $mod    = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3649
                $serie  = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
3650
                $numero = $umaRefNFe->getElementsByTagName('nNF')->item(0)->nodeValue;
3651
                $data   = substr($data, 2, 2) . "/20" . substr($data, 0, 2);
3652
                $cnpj   = $this->formatField($cnpj, "##.###.###/####-##");
3653
                $saida  .= sprintf($formaNfRef, $serie, $numero, $cnpj, $data, $mod);
3654
            }
3655
            $refCTe = $nfRef->getElementsByTagName('refCTe');
3656
            foreach ($refCTe as $chave_acessoRef) {
3657
                $chave_acesso  = $chave_acessoRef->nodeValue;
3658
                $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3659
                $data          = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3660
                $cnpj          = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3661
                $serie         = substr($chave_acesso, 22, 3);
3662
                $numero        = substr($chave_acesso, 25, 9);
3663
                $saida         .= sprintf($formaCTeRef, $serie, $numero, $cnpj, $data, $chave_acessoF);
3664
            }
3665
            $refECF = $nfRef->getElementsByTagName('refECF');
3666
            foreach ($refECF as $umaRefNFe) {
3667
                $mod   = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3668
                $nECF  = $umaRefNFe->getElementsByTagName('nECF')->item(0)->nodeValue;
3669
                $nCOO  = $umaRefNFe->getElementsByTagName('nCOO')->item(0)->nodeValue;
3670
                $saida .= sprintf($formaECFRef, $mod, $nECF, $nCOO);
3671
            }
3672
            $refNFP = $nfRef->getElementsByTagName('refNFP');
3673
            foreach ($refNFP as $umaRefNFe) {
3674
                $data   = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3675
                $cnpj   = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3676
                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue :
3677
                    '';
3678
                $cpf    = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3679
                    $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : '';
3680
                $mod    = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3681
                $serie  = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
3682
                $numero = $umaRefNFe->getElementsByTagName('nNF')->item(0)->nodeValue;
3683
                $ie     = $umaRefNFe->getElementsByTagName('IE')->item(0)->nodeValue;
3684
                $data   = substr($data, 2, 2) . "/20" . substr($data, 0, 2);
3685
                if ($cnpj == '') {
3686
                    $cpf_cnpj = $this->formatField($cpf, "###.###.###-##");
3687
                } else {
3688
                    $cpf_cnpj = $this->formatField($cnpj, "##.###.###/####-##");
3689
                }
3690
                $saida .= sprintf($formaNfpRef, $serie, $numero, $cpf_cnpj, $data, $mod, $ie);
3691
            }
3692
        }
3693
3694
        return $saida;
3695
    }
3696
3697
    private function loadDoc($xml)
3698
    {
3699
        $this->xml = $xml;
3700
        if (! empty($xml)) {
3701
            $this->dom = new Dom();
3702
            $this->dom->loadXML($this->xml);
3703
            if (empty($this->dom->getElementsByTagName("infNFe")->item(0))) {
3704
                throw new \Exception('Isso não é um NFe.');
3705
            }
3706
            $this->nfeProc = $this->dom->getElementsByTagName("nfeProc")->item(0);
3707
            $this->infNFe  = $this->dom->getElementsByTagName("infNFe")->item(0);
3708
            $this->ide     = $this->dom->getElementsByTagName("ide")->item(0);
3709
            if ($this->getTagValue($this->ide, "mod") != '55') {
3710
                throw new \Exception("O xml deve ser NF-e modelo 55.");
3711
            }
3712
            $this->entrega    = $this->dom->getElementsByTagName("entrega")->item(0);
3713
            $this->retirada   = $this->dom->getElementsByTagName("retirada")->item(0);
3714
            $this->emit       = $this->dom->getElementsByTagName("emit")->item(0);
3715
            $this->dest       = $this->dom->getElementsByTagName("dest")->item(0);
3716
            $this->enderEmit  = $this->dom->getElementsByTagName("enderEmit")->item(0);
3717
            $this->enderDest  = $this->dom->getElementsByTagName("enderDest")->item(0);
3718
            $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...
3719
            $this->cobr       = $this->dom->getElementsByTagName("cobr")->item(0);
3720
            $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...
3721
            $this->ICMSTot    = $this->dom->getElementsByTagName("ICMSTot")->item(0);
3722
            $this->ISSQNtot   = $this->dom->getElementsByTagName("ISSQNtot")->item(0);
3723
            $this->transp     = $this->dom->getElementsByTagName("transp")->item(0);
3724
            $this->transporta = $this->dom->getElementsByTagName("transporta")->item(0);
3725
            $this->veicTransp = $this->dom->getElementsByTagName("veicTransp")->item(0);
3726
            $this->detPag     = $this->dom->getElementsByTagName("detPag");
3727
            $this->reboque    = $this->dom->getElementsByTagName("reboque")->item(0);
3728
            $this->infAdic    = $this->dom->getElementsByTagName("infAdic")->item(0);
3729
            $this->compra     = $this->dom->getElementsByTagName("compra")->item(0);
3730
            $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...
3731
            $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...
3732
            $this->infProt    = $this->dom->getElementsByTagName("infProt")->item(0);
3733
        }
3734
    }
3735
3736
    /**
3737
     * @param $item
3738
     *
3739
     * @return float
3740
     */
3741
    protected function calculeHeight($item)
3742
    {
3743
        if ($this->orientacao == 'P') {
3744
            $w = $this->wPrint;
3745
        } else {
3746
            $w = $this->wPrint - $this->wCanhoto;
3747
        }
3748
        $w2           = round($w * 0.25, 0);
3749
        $aFont        = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
3750
        $textoProduto = $this->descricaoProduto($item);
3751
        $numlinhas    = $this->pdf->getNumLines($textoProduto, $w2, $aFont);
3752
3753
        return round(($numlinhas * $this->pdf->fontSize) + ($numlinhas * 0.5), 2);
3754
    }
3755
}
3756