Passed
Pull Request — master (#392)
by Eduardo
03:14
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
        /*($hcabecalho +
550
        //$hdestinatario + ($linhasDup * $hduplicatas) + $himposto + $htransporte +
551
        $hdestinatario + $hlocalentrega + $hlocalretirada +
552
        ($linhasDup * $hduplicatas) + $himposto + $htransporte +
553
        ($linhaISSQN * $hissqn) + $this->hdadosadic + $hfooter + $hCabecItens +
554
        $this->sizeExtraTextoFatura());*/
555
556
        if ($this->orientacao == 'P') {
557
            $hDispo1 -= 24 * $this->qCanhoto;//para canhoto
558
            $w       = $this->wPrint;
559
        } else {
560
            $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...
561
            $w        = $this->wPrint - $this->wCanhoto;
562
        }
563
        //$hDispo1 += 14;
564
        $hDispo2 = $this->hPrint - ($hcabecalho + $hfooter + $hCabecItens);
565
        //Contagem da altura ocupada para impressão dos itens
566
        $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...
567
        $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...
568
        $hUsado    = $hCabecItens;
569
        $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...
570
        $hDispo    = $hDispo1;
571
        $totPag    = 1;
572
        $i         = 0;
573
        while ($i < $this->det->length) {
574
            $hUsado += $this->calculeHeight($this->det->item($i));
575
            if ($hUsado > $hDispo) {
576
                $totPag ++;
577
                $hDispo = $hDispo2;
578
                $hUsado = $hCabecItens;
579
                $i --; // decrementa para readicionar o item que não coube nessa pagina na outra.
580
            }
581
            $i ++;
582
        } //fim da soma das areas de itens usadas
583
        $qtdeItens = $i; //controle da quantidade de itens no DANFE
584
        //montagem da primeira página
585
        $pag = 1;
586
587
        $x = $this->margesq;
588
        $y = $this->margsup;
589
        //coloca o(s) canhoto(s) da NFe
590
        if ($this->orientacao == 'P') {
591
            $y = $this->canhoto($this->margesq, $this->margsup);
592
        } else {
593
            $this->canhoto($this->margesq, $this->margsup);
594
            $x = 25;
595
        }
596
        //coloca o cabeçalho
597
        $y = $this->header($x, $y, $pag, $totPag);
598
        //coloca os dados do destinatário
599
        $y = $this->destinatarioDANFE($x, $y + 1);
600
        //coloca os dados do local de retirada
601
        if (isset($this->retirada)) {
602
            $y = $this->localRetiradaDANFE($x, $y + 1);
603
        }
604
        //coloca os dados do local de entrega
605
        if (isset($this->entrega)) {
606
            $y = $this->localEntregaDANFE($x, $y + 1);
607
        }
608
609
        //Verifica as formas de pagamento da nota fiscal
610
        $formaPag = [];
611
        if (isset($this->detPag) && $this->detPag->length > 0) {
612
            foreach ($this->detPag as $k => $d) {
613
                $fPag            = ! empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
614
                    ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue
615
                    : '0';
616
                $formaPag[$fPag] = $fPag;
617
            }
618
        }
619
        //caso tenha boleto imprimir fatura
620
        if ($this->dup->length > 0) {
621
            $y = $this->fatura($x, $y + 1);
622
        } else {
623
            //Se somente tiver a forma de pagamento sem pagamento não imprimir nada
624
            if (count($formaPag) == '1' && isset($formaPag[90])) {
625
                $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...
626
            } else {
627
                //caso tenha mais de uma forma de pagamento ou seja diferente de boleto exibe a
628
                //forma de pagamento e o valor
629
                $y = $this->pagamento($x, $y + 1);
630
            }
631
        }
632
        //coloca os dados dos impostos e totais da NFe
633
        $y = $this->imposto($x, $y + 1);
634
        //coloca os dados do trasnporte
635
        $y = $this->transporte($x, $y + 1);
636
        //itens da DANFE
637
        $nInicial = 0;
638
639
        $y = $this->itens($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
640
641
        //coloca os dados do ISSQN
642
        if ($linhaISSQN == 1) {
643
            $y = $this->issqn($x, $y + 4);
644
        } else {
645
            $y += 4;
646
        }
647
        //coloca os dados adicionais da NFe
648
        $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...
649
        //coloca o rodapé da página
650
        if ($this->orientacao == 'P') {
651
            $this->rodape($xInic);
652
        } else {
653
            $this->rodape($xInic);
654
        }
655
656
        //loop para páginas seguintes
657
        for ($n = 2; $n <= $totPag; $n ++) {
658
            // fixa as margens
659
            $this->pdf->setMargins($this->margesq, $this->margsup);
660
            //adiciona nova página
661
            $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...
662
            //ajusta espessura das linhas
663
            $this->pdf->setLineWidth(0.1);
664
            //seta a cor do texto para petro
665
            $this->pdf->settextcolor(0, 0, 0);
666
            // posição inicial do relatorio
667
            $x = $this->margesq;
668
            $y = $this->margsup;
669
            //coloca o cabeçalho na página adicional
670
            $y = $this->header($x, $y, $n, $totPag);
671
            //coloca os itens na página adicional
672
            $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...
673
            //coloca o rodapé da página
674
            if ($this->orientacao == 'P') {
675
                $this->rodape($this->margesq);
676
            } else {
677
                $this->rodape($this->margesq);
678
            }
679
            //se estiver na última página e ainda restar itens para inserir, adiciona mais uma página
680
            if ($n == $totPag && $this->qtdeItensProc < $qtdeItens) {
681
                $totPag ++;
682
            }
683
        }
684
    }
685
686
    /**
687
     * anfavea
688
     * Função para transformar o campo cdata do padrão ANFAVEA para
689
     * texto imprimível
690
     *
691
     * @param string $cdata campo CDATA
692
     *
693
     * @return string conteúdo do campo CDATA como string
694
     */
695
    protected function anfaveaDANFE($cdata = '')
696
    {
697
        if ($cdata == '') {
698
            return '';
699
        }
700
        //remove qualquer texto antes ou depois da tag CDATA
701
        $cdata    = str_replace('<![CDATA[', '<CDATA>', $cdata);
702
        $cdata    = str_replace(']]>', '</CDATA>', $cdata);
703
        $cdata    = preg_replace('/\s\s+/', ' ', $cdata);
704
        $cdata    = str_replace("> <", "><", $cdata);
705
        $len      = strlen($cdata);
706
        $startPos = strpos($cdata, '<');
707
        if ($startPos === false) {
708
            return $cdata;
709
        }
710
        for ($x = $len; $x > 0; $x --) {
711
            if (substr($cdata, $x, 1) == '>') {
712
                $endPos = $x;
713
                break;
714
            }
715
        }
716
        if ($startPos > 0) {
717
            $parte1 = substr($cdata, 0, $startPos);
718
        } else {
719
            $parte1 = '';
720
        }
721
        $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...
722
        if ($endPos < $len) {
723
            $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
724
        } else {
725
            $parte3 = '';
726
        }
727
        $texto = trim($parte1) . ' ' . trim($parte3);
728
        if (strpos($parte2, '<CDATA>') === false) {
729
            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
730
        } else {
731
            $cdata = $parte2;
732
        }
733
        //Retira a tag <FONTE IBPT> (caso existir) pois não é uma estrutura válida XML
734
        $cdata = str_replace('<FONTE IBPT>', '', $cdata);
735
        //carrega o xml CDATA em um objeto DOM
736
        $dom = new Dom();
737
        $dom->loadXML($cdata, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG);
738
        //$xml = $dom->saveXML();
739
        //grupo CDATA infADprod
740
        $id   = $dom->getElementsByTagName('id')->item(0);
741
        $div  = $dom->getElementsByTagName('div')->item(0);
742
        $entg = $dom->getElementsByTagName('entg')->item(0);
743
        $dest = $dom->getElementsByTagName('dest')->item(0);
744
        $ctl  = $dom->getElementsByTagName('ctl')->item(0);
745
        $ref  = $dom->getElementsByTagName('ref')->item(0);
746
        if (isset($id)) {
747
            if ($id->hasAttributes()) {
748
                foreach ($id->attributes as $attr) {
749
                    $name  = $attr->nodeName;
750
                    $value = $attr->nodeValue;
751
                    $texto .= " $name : $value";
752
                }
753
            }
754
        }
755
        if (isset($div)) {
756
            if ($div->hasAttributes()) {
757
                foreach ($div->attributes as $attr) {
758
                    $name  = $attr->nodeName;
759
                    $value = $attr->nodeValue;
760
                    $texto .= " $name : $value";
761
                }
762
            }
763
        }
764
        if (isset($entg)) {
765
            if ($entg->hasAttributes()) {
766
                foreach ($entg->attributes as $attr) {
767
                    $name  = $attr->nodeName;
768
                    $value = $attr->nodeValue;
769
                    $texto .= " $name : $value";
770
                }
771
            }
772
        }
773
        if (isset($dest)) {
774
            if ($dest->hasAttributes()) {
775
                foreach ($dest->attributes as $attr) {
776
                    $name  = $attr->nodeName;
777
                    $value = $attr->nodeValue;
778
                    $texto .= " $name : $value";
779
                }
780
            }
781
        }
782
        if (isset($ctl)) {
783
            if ($ctl->hasAttributes()) {
784
                foreach ($ctl->attributes as $attr) {
785
                    $name  = $attr->nodeName;
786
                    $value = $attr->nodeValue;
787
                    $texto .= " $name : $value";
788
                }
789
            }
790
        }
791
        if (isset($ref)) {
792
            if ($ref->hasAttributes()) {
793
                foreach ($ref->attributes as $attr) {
794
                    $name  = $attr->nodeName;
795
                    $value = $attr->nodeValue;
796
                    $texto .= " $name : $value";
797
                }
798
            }
799
        }
800
        //grupo CADATA infCpl
801
        $t          = $dom->getElementsByTagName('transmissor')->item(0);
802
        $r          = $dom->getElementsByTagName('receptor')->item(0);
803
        $versao     = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
804
            'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
805
        $especieNF  = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
806
            'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
807
        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
808
            'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
809
        $dca        = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
810
            'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
811
        $texto      .= "" . $versao . $especieNF . $fabEntrega . $dca;
812
        if (isset($t)) {
813
            if ($t->hasAttributes()) {
814
                $texto .= " Transmissor ";
815
                foreach ($t->attributes as $attr) {
816
                    $name  = $attr->nodeName;
817
                    $value = $attr->nodeValue;
818
                    $texto .= " $name : $value";
819
                }
820
            }
821
        }
822
        if (isset($r)) {
823
            if ($r->hasAttributes()) {
824
                $texto .= " Receptor ";
825
                foreach ($r->attributes as $attr) {
826
                    $name  = $attr->nodeName;
827
                    $value = $attr->nodeValue;
828
                    $texto .= " $name : $value";
829
                }
830
            }
831
        }
832
833
        return $texto;
834
    }
835
836
    /**
837
     * Verifica o status da NFe
838
     *
839
     * @return array
840
     */
841
    protected function statusNFe()
842
    {
843
        if (! isset($this->nfeProc)) {
844
            return ['status' => false, 'message' => 'NFe NÃO PROTOCOLADA'];
845
        }
846
        if ($this->getTagValue($this->ide, "tpAmb") == '2') {
847
            return ['status' => false, 'message' => 'NFe EMITIDA EM HOMOLOGAÇÃO'];
848
        }
849
        $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...
850
        if ($cStat == '101'
851
            || $cStat == '151'
852
            || $cStat == '135'
853
            || $cStat == '155'
854
            || $this->cancelFlag === true
855
        ) {
856
            return ['status' => false, 'message' => 'NFe CANCELADA'];
857
        }
858
859
        if ($cStat == '110' ||
860
            $cStat == '301' ||
861
            $cStat == '302'
862
863
        ) {
864
            return ['status' => false, 'message' => 'NFe DENEGADA'];
865
        }
866
867
        return ['status' => true, 'message' => ''];
868
    }
869
870
    protected function notaDPEC()
871
    {
872
        return ! empty($this->numdepec);
873
    }
874
875
    /**
876
     *header
877
     * Monta o cabelhalho da DANFE (retrato e paisagem)
878
     *
879
     * @param number $x      Posição horizontal inicial, canto esquerdo
880
     * @param number $y      Posição vertical inicial, canto superior
881
     * @param number $pag    Número da Página
882
     * @param number $totPag Total de páginas
883
     *
884
     * @return number Posição vertical final
885
     */
886
    protected function header($x = 0, $y = 0, $pag = '1', $totPag = '1')
887
    {
888
        $oldX = $x;
889
        $oldY = $y;
890
        if ($this->orientacao == 'P') {
891
            $maxW = $this->wPrint;
892
        } else {
893
            if ($pag == 1) { // primeira página
894
                $maxW = $this->wPrint - $this->wCanhoto;
895
            } else { // páginas seguintes
896
                $maxW = $this->wPrint;
897
            }
898
        }
899
        //####################################################################################
900
        //coluna esquerda identificação do emitente
901
        $w = round($maxW * 0.41, 0);
902
        if ($this->orientacao == 'P') {
903
            $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I'];
904
        } else {
905
            $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
906
        }
907
        $w1   = $w;
908
        $h    = 32;
909
        $oldY += $h;
910
        $this->pdf->textBox($x, $y, $w, $h);
911
        $texto = 'IDENTIFICAÇÃO DO EMITENTE';
912
        $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...
913
        //estabelecer o alinhamento
914
        //pode ser left L, center C, right R, full logo L
915
        //se for left separar 1/3 da largura para o tamanho da imagem
916
        //os outros 2/3 serão usados para os dados do emitente
917
        //se for center separar 1/2 da altura para o logo e 1/2 para os dados
918
        //se for right separa 2/3 para os dados e o terço seguinte para o logo
919
        //se não houver logo centraliza dos dados do emitente
920
        // coloca o logo
921
        if (! empty($this->logomarca)) {
922
            $logoInfo = getimagesize($this->logomarca);
923
            //largura da imagem em mm
924
            $logoWmm = ($logoInfo[0] / 72) * 25.4;
925
            //altura da imagem em mm
926
            $logoHmm = ($logoInfo[1] / 72) * 25.4;
927
            if ($this->logoAlign == 'L') {
928
                $nImgW = round($w / 3, 0);
929
                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
930
                $xImg  = $x + 1;
931
                $yImg  = round(($h - $nImgH) / 2, 0) + $y;
932
                //estabelecer posições do texto
933
                $x1 = round($xImg + $nImgW + 1, 0);
934
                $y1 = round($h / 3 + $y, 0);
935
                $tw = round(2 * $w / 3, 0);
936
            } elseif ($this->logoAlign == 'C') {
937
                $nImgH = round($h / 3, 0);
938
                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
939
                $xImg  = round(($w - $nImgW) / 2 + $x, 0);
940
                $yImg  = $y + 3;
941
                $x1    = $x;
942
                $y1    = round($yImg + $nImgH + 1, 0);
943
                $tw    = $w;
944
            } elseif ($this->logoAlign == 'R') {
945
                $nImgW = round($w / 3, 0);
946
                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
947
                $xImg  = round($x + ($w - (1 + $nImgW)), 0);
948
                $yImg  = round(($h - $nImgH) / 2, 0) + $y;
949
                $x1    = $x;
950
                $y1    = round($h / 3 + $y, 0);
951
                $tw    = round(2 * $w / 3, 0);
952
            } elseif ($this->logoAlign == 'F') {
953
                $nImgH = round($h - 5, 0);
954
                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
955
                $xImg  = round(($w - $nImgW) / 2 + $x, 0);
956
                $yImg  = $y + 3;
957
                $x1    = $x;
958
                $y1    = round($yImg + $nImgH + 1, 0);
959
                $tw    = $w;
960
            }
961
            $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...
962
            $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...
963
        } else {
964
            $x1 = $x;
965
            $y1 = round($h / 3 + $y, 0);
966
            $tw = $w;
967
        }
968
        // monta as informações apenas se diferente de full logo
969
        if ($this->logoAlign !== 'F') {
970
            //Nome emitente
971
            $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B'];
972
            $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
973
            $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...
974
            //endereço
975
            $y1     = $y1 + 5;
976
            $aFont  = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
977
            $fone   = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
978
                ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
979
                : '';
980
            $lgr    = $this->getTagValue($this->enderEmit, "xLgr");
981
            $nro    = $this->getTagValue($this->enderEmit, "nro");
982
            $cpl    = $this->getTagValue($this->enderEmit, "xCpl", " - ");
983
            $bairro = $this->getTagValue($this->enderEmit, "xBairro");
984
            $CEP    = $this->getTagValue($this->enderEmit, "CEP");
985
            $CEP    = $this->formatField($CEP, "#####-###");
986
            $mun    = $this->getTagValue($this->enderEmit, "xMun");
987
            $UF     = $this->getTagValue($this->enderEmit, "UF");
988
            $texto  = $lgr . ", " . $nro . $cpl . "\n" . $bairro . " - "
989
                . $CEP . "\n" . $mun . " - " . $UF . " "
990
                . "Fone/Fax: " . $fone;
991
            $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...
992
        }
993
994
        //####################################################################################
995
        //coluna central Danfe
996
        $x  += $w;
997
        $w  = round($maxW * 0.17, 0);//35;
998
        $w2 = $w;
999
        $h  = 32;
1000
        $this->pdf->textBox($x, $y, $w, $h);
1001
1002
        $texto = "DANFE";
1003
        $aFont = ['font' => $this->fontePadrao, 'size' => 14, 'style' => 'B'];
1004
        $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...
1005
        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
1006
        $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
1007
        $h     = 20;
1008
        $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...
1009
1010
        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
1011
        $texto = '0 - ENTRADA';
1012
        $y1    = $y + 14;
1013
        $h     = 8;
1014
        $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...
1015
        $texto = '1 - SAÍDA';
1016
        $y1    = $y + 17;
1017
        $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...
1018
        //tipo de nF
1019
        $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B'];
1020
        $y1    = $y + 13;
1021
        $h     = 7;
1022
        $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
1023
        $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...
1024
        //numero da NF
1025
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1026
        $y1    = $y + 20;
1027
        $numNF = str_pad(
1028
            $this->ide->getElementsByTagName('nNF')->item(0)->nodeValue,
1029
            9,
1030
            "0",
1031
            STR_PAD_LEFT
1032
        );
1033
        $numNF = $this->formatField($numNF, "###.###.###");
1034
        $texto = "Nº. " . $numNF;
1035
        $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...
1036
        //Série
1037
        $y1    = $y + 23;
1038
        $serie = str_pad(
1039
            $this->ide->getElementsByTagName('serie')->item(0)->nodeValue,
1040
            3,
1041
            "0",
1042
            STR_PAD_LEFT
1043
        );
1044
        $texto = "Série " . $serie;
1045
        $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...
1046
        //numero paginas
1047
        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'I'];
1048
        $y1    = $y + 26;
1049
        $texto = "Folha " . $pag . "/" . $totPag;
1050
        $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...
1051
1052
        //####################################################################################
1053
        //coluna codigo de barras
1054
        $x  += $w;
1055
        $w  = ($maxW - $w1 - $w2);//85;
1056
        $w3 = $w;
1057
        $h  = 32;
1058
        $this->pdf->textBox($x, $y, $w, $h);
1059
        $this->pdf->setFillColor(0, 0, 0);
1060
        $chave_acesso = str_replace('NFe', '', $this->infNFe->getAttribute("Id"));
1061
        $bW           = 75;
1062
        $bH           = 12;
1063
        //codigo de barras
1064
        $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
1065
        //linhas divisorias
1066
        $this->pdf->line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH);
1067
        $this->pdf->line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH);
1068
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1069
        $y1    = $y + 4 + $bH;
1070
        $h     = 7;
1071
        $texto = 'CHAVE DE ACESSO';
1072
        $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...
1073
        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
1074
        $y1    = $y + 8 + $bH;
1075
        $texto = $this->formatField($chave_acesso, $this->formatoChave);
1076
        $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...
1077
        $y1                = $y + 12 + $bH;
1078
        $aFont             = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
1079
        $chaveContingencia = "";
1080
        if ($this->notaDpec()) {
1081
            $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC';
1082
        } else {
1083
            $cabecalhoProtoAutorizacao = 'PROTOCOLO DE AUTORIZAÇÃO DE USO';
1084
        }
1085
        if (($this->tpEmis == 2 || $this->tpEmis == 5) && ! $this->notaDpec()) {
1086
            $cabecalhoProtoAutorizacao = "DADOS DA NF-E";
1087
            $chaveContingencia         = $this->geraChaveAdicionalDeContingencia();
1088
            $this->pdf->setFillColor(0, 0, 0);
1089
            //codigo de barras
1090
            $this->pdf->code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2);
1091
        } else {
1092
            $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1093
            $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...
1094
            $y1    = $y + 16 + $bH;
1095
            $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1096
            $this->pdf->textBox(
1097
                $x + 2,
1098
                $y1,
1099
                $w - 2,
1100
                $h,
1101
                $texto,
1102
                $aFont,
1103
                'T',
1104
                'C',
1105
                0,
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1106
                'http://www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora'
1107
            );
1108
        }
1109
1110
        //####################################################################################
1111
        //Dados da NF do cabeçalho
1112
        //natureza da operação
1113
        $texto = 'NATUREZA DA OPERAÇÃO';
1114
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1115
        $w     = $w1 + $w2;
1116
        $y     = $oldY;
1117
        $oldY  += $h;
1118
        $x     = $oldX;
1119
        $h     = 7;
1120
        $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...
1121
        $texto = $this->ide->getElementsByTagName("natOp")->item(0)->nodeValue;
1122
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1123
        $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...
1124
        $x += $w;
1125
        $w = $w3;
1126
        //PROTOCOLO DE AUTORIZAÇÃO DE USO ou DADOS da NF-E
1127
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1128
        $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...
1129
        // algumas NFe podem estar sem o protocolo de uso portanto sua existencia deve ser
1130
        // testada antes de tentar obter a informação.
1131
        // NOTA : DANFE sem protocolo deve existir somente no caso de contingência !!!
1132
        // Além disso, existem várias NFes em contingência que eu recebo com protocolo de autorização.
1133
        // Na minha opinião, deveríamos mostra-lo, mas o  manual  da NFe v4.01 diz outra coisa...
1134
        if (($this->tpEmis == 2 || $this->tpEmis == 5) && ! $this->notaDpec()) {
1135
            $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
1136
            $texto = $this->formatField(
1137
                $chaveContingencia,
1138
                "#### #### #### #### #### #### #### #### ####"
1139
            );
1140
            $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...
1141
        } else {
1142
            $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1143
            if ($this->notaDpec()) {
1144
                $texto = $this->numdepec;
1145
                $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...
1146
            } else {
1147
                if (isset($this->nfeProc)) {
1148
                    $texto  = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue)
1149
                        ? $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue
1150
                        : '';
1151
                    $tsHora = $this->toTimestamp(
1152
                        $this->nfeProc->getElementsByTagName("dhRecbto")->item(0)->nodeValue
1153
                    );
1154
                    if ($texto != '') {
1155
                        $texto .= "  -  " . date('d/m/Y H:i:s', $tsHora);
1156
                    }
1157
                    $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...
1158
                } else {
1159
                    $texto = '';
1160
                    $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...
1161
                }
1162
            }
1163
        }
1164
        $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...
1165
        //####################################################################################
1166
        //INSCRIÇÃO ESTADUAL
1167
        $w     = round($maxW * 0.250, 0);
1168
        $y     += $h;
1169
        $oldY  += $h;
1170
        $x     = $oldX;
1171
        $texto = 'INSCRIÇÃO ESTADUAL';
1172
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1173
        $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...
1174
        $texto = $this->getTagValue($this->emit, "IE");
1175
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1176
        $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...
1177
        //INSCRIÇÃO MUNICIPAL
1178
        $x     += $w;
1179
        $texto = 'INSCRIÇÃO MUNICIPAL';
1180
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1181
        $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...
1182
        $texto = $this->getTagValue($this->emit, "IM");
1183
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1184
        $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...
1185
        //INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.
1186
        $x     += $w;
1187
        $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.';
1188
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1189
        $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...
1190
        $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1191
            ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue
1192
            : '';
1193
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1194
        $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...
1195
        //CNPJ
1196
        $x     += $w;
1197
        $w     = ($maxW - (3 * $w));
1198
        $texto = 'CNPJ';
1199
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1200
        $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...
1201
        //Pegando valor do CPF/CNPJ
1202
        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1203
            $texto = $this->formatField(
1204
                $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1205
                "###.###.###/####-##"
1206
            );
1207
        } else {
1208
            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue)
1209
                ? $this->formatField(
1210
                    $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1211
                    "###.###.###-##"
1212
                )
1213
                : '';
1214
        }
1215
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1216
        $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...
1217
1218
        //####################################################################################
1219
        //Indicação de NF Homologação, cancelamento e falta de protocolo
1220
        $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...
1221
        //indicar cancelamento
1222
        $resp = $this->statusNFe();
1223
        if (! $resp['status']) {
1224
            $x = 10;
1225
            $y = $this->hPrint - 130;
1226
            $h = 25;
1227
            $w = $maxW - (2 * $x);
1228
            $this->pdf->settextcolor(90, 90, 90);
1229
            $texto = $resp['message'];
1230
            $aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B'];
1231
            $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...
1232
            $y += $h;
1233
            $h = 5;
1234
            $w = $maxW - (2 * $x);
1235
            if (isset($this->infProt) && $resp['status']) {
1236
                $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue;
1237
            } else {
1238
                $xMotivo = '';
1239
            }
1240
            $texto = "SEM VALOR FISCAL\n" . $xMotivo;
1241
            $aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B'];
1242
            $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...
1243
            $this->pdf->settextcolor(0, 0, 0);
1244
        }
1245
        if ($this->notaDpec() || $this->tpEmis == 4) {
1246
            //DPEC
1247
            $x = 10;
1248
            $y = $this->hPrint - 130;
1249
            $h = 25;
1250
            $w = $maxW - (2 * $x);
1251
            $this->pdf->SetTextColor(200, 200, 200);
1252
            $texto = "DANFE impresso em contingência -\n" .
1253
                "DPEC regularmente recebido pela Receita\n" .
1254
                "Federal do Brasil";
1255
            $aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B'];
1256
            $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...
1257
            $this->pdf->SetTextColor(0, 0, 0);
1258
        }
1259
1260
        return $oldY;
1261
    } //fim header
1262
1263
    /**
1264
     * destinatarioDANFE
1265
     * Monta o campo com os dados do destinatário na DANFE. (retrato e paisagem)
1266
     *
1267
     * @name   destinatarioDANFE
1268
     *
1269
     * @param number $x Posição horizontal canto esquerdo
1270
     * @param number $y Posição vertical canto superior
1271
     *
1272
     * @return number Posição vertical final
1273
     */
1274
    protected function destinatarioDANFE($x = 0, $y = 0)
1275
    {
1276
        //####################################################################################
1277
        //DESTINATÁRIO / REMETENTE
1278
        $oldX = $x;
1279
        $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...
1280
        if ($this->orientacao == 'P') {
1281
            $maxW = $this->wPrint;
1282
        } else {
1283
            $maxW = $this->wPrint - $this->wCanhoto;
1284
        }
1285
        $w     = $maxW;
1286
        $h     = 7;
1287
        $texto = 'DESTINATÁRIO / REMETENTE';
1288
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1289
        $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...
1290
        //NOME / RAZÃO SOCIAL
1291
        $w     = round($maxW * 0.61, 0);
1292
        $w1    = $w;
1293
        $y     += 3;
1294
        $texto = 'NOME / RAZÃO SOCIAL';
1295
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1296
        $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...
1297
        $texto = $this->dest->getElementsByTagName("xNome")->item(0)->nodeValue;
1298
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1299
        if ($this->orientacao == 'P') {
1300
            $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...
1301
        } else {
1302
            $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...
1303
        }
1304
        //CNPJ / CPF
1305
        $x     += $w;
1306
        $w     = round($maxW * 0.23, 0);
1307
        $w2    = $w;
1308
        $texto = 'CNPJ / CPF';
1309
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1310
        $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...
1311
        //Pegando valor do CPF/CNPJ
1312
        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1313
            $texto = $this->formatField(
1314
                $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1315
                "###.###.###/####-##"
1316
            );
1317
        } else {
1318
            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue)
1319
                ? $this->formatField(
1320
                    $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1321
                    "###.###.###-##"
1322
                )
1323
                : '';
1324
        }
1325
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1326
        $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...
1327
        //DATA DA EMISSÃO
1328
        $x     += $w;
1329
        $w     = $maxW - ($w1 + $w2);
1330
        $wx    = $w;
1331
        $texto = 'DATA DA EMISSÃO';
1332
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1333
        $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...
1334
        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue)
1335
            ? $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue
1336
            : '';
1337
        if ($dEmi == '') {
1338
            $dEmi  = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue)
1339
                ? $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue
1340
                : '';
1341
            $aDemi = explode('T', $dEmi);
1342
            $dEmi  = $aDemi[0];
1343
        }
1344
        $texto = $this->ymdTodmy($dEmi);
1345
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1346
        if ($this->orientacao == 'P') {
1347
            $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...
1348
        } else {
1349
            $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...
1350
        }
1351
        //ENDEREÇO
1352
        $w     = round($maxW * 0.47, 0);
1353
        $w1    = $w;
1354
        $y     += $h;
1355
        $x     = $oldX;
1356
        $texto = 'ENDEREÇO';
1357
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1358
        $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...
1359
        $texto = $this->dest->getElementsByTagName("xLgr")->item(0)->nodeValue;
1360
        $texto .= ', ' . $this->dest->getElementsByTagName("nro")->item(0)->nodeValue;
1361
        $texto .= $this->getTagValue($this->dest, "xCpl", " - ");
1362
1363
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1364
        $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...
1365
        //BAIRRO / DISTRITO
1366
        $x     += $w;
1367
        $w     = round($maxW * 0.21, 0);
1368
        $w2    = $w;
1369
        $texto = 'BAIRRO / DISTRITO';
1370
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1371
        $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...
1372
        $texto = $this->dest->getElementsByTagName("xBairro")->item(0)->nodeValue;
1373
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1374
        $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...
1375
        //CEP
1376
        $x     += $w;
1377
        $w     = $maxW - $w1 - $w2 - $wx;
1378
        $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...
1379
        $texto = 'CEP';
1380
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1381
        $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...
1382
        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue)
1383
            ? $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue
1384
            : '';
1385
        $texto = $this->formatField($texto, "#####-###");
1386
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1387
        $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...
1388
        //DATA DA SAÍDA
1389
        $x     += $w;
1390
        $w     = $wx;
1391
        $texto = 'DATA DA SAÍDA/ENTRADA';
1392
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1393
        $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...
1394
        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue)
1395
            ? $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue
1396
            : '';
1397
        if ($dSaiEnt == '') {
1398
            $dSaiEnt  = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1399
                ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1400
                : '';
1401
            $aDsaient = explode('T', $dSaiEnt);
1402
            $dSaiEnt  = $aDsaient[0];
1403
        }
1404
        $texto = $this->ymdTodmy($dSaiEnt);
1405
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1406
        $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...
1407
        //MUNICÍPIO
1408
        $w     = $w1;
1409
        $y     += $h;
1410
        $x     = $oldX;
1411
        $texto = 'MUNICÍPIO';
1412
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1413
        $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...
1414
        $texto = $this->dest->getElementsByTagName("xMun")->item(0)->nodeValue;
1415
        if (strtoupper(trim($texto)) == "EXTERIOR"
1416
            && $this->dest->getElementsByTagName("xPais")->length > 0
1417
        ) {
1418
            $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1419
        }
1420
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1421
        $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...
1422
        //UF
1423
        $x     += $w;
1424
        $w     = 8;
1425
        $texto = 'UF';
1426
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1427
        $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...
1428
        $texto = $this->dest->getElementsByTagName("UF")->item(0)->nodeValue;
1429
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1430
        $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...
1431
        //FONE / FAX
1432
        $x     += $w;
1433
        $w     = round(($maxW - $w1 - $wx - 8) / 2, 0);
1434
        $w3    = $w;
1435
        $texto = 'FONE / FAX';
1436
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1437
        $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...
1438
        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue)
1439
            ? $this->dest->getElementsByTagName("fone")->item(0)->nodeValue
1440
            : '';
1441
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1442
        $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...
1443
        //INSCRIÇÃO ESTADUAL
1444
        $x     += $w;
1445
        $w     = $maxW - $w1 - $wx - 8 - $w3;
1446
        $texto = 'INSCRIÇÃO ESTADUAL';
1447
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1448
        $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...
1449
        $IE    = $this->dest->getElementsByTagName("IE");
1450
        $texto = ($IE && $IE->length > 0) ? $IE->item(0)->nodeValue : '';
1451
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1452
        $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...
1453
        //HORA DA SAÍDA
1454
        $x     += $w;
1455
        $w     = $wx;
1456
        $texto = 'HORA DA SAÍDA/ENTRADA';
1457
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1458
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1459
        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue)
1460
            ? $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue
1461
            : '';
1462
        if ($hSaiEnt == '') {
1463
            $dhSaiEnt   = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1464
                ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1465
                : '';
1466
            $tsDhSaiEnt = $this->toTimestamp($dhSaiEnt);
1467
            if ($tsDhSaiEnt != '') {
1468
                $hSaiEnt = date('H:i:s', $tsDhSaiEnt);
1469
            }
1470
        }
1471
        $texto = $hSaiEnt;
1472
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1473
        $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...
1474
1475
        return ($y + $h);
1476
    } //fim da função destinatarioDANFE
1477
1478
    /**
1479
     * localEntregaDANFE
1480
     * Monta o campo com os dados do local de entrega na DANFE. (retrato e paisagem)
1481
     *
1482
     * @name   localEntregaDANFE
1483
     *
1484
     * @param number $x Posição horizontal canto esquerdo
1485
     * @param number $y Posição vertical canto superior
1486
     *
1487
     * @return number Posição vertical final
1488
     */
1489
    protected function localEntregaDANFE($x = 0, $y = 0)
1490
    {
1491
        //####################################################################################
1492
        //LOCAL DE ENTREGA
1493
        $oldX = $x;
1494
        if ($this->orientacao == 'P') {
1495
            $maxW = $this->wPrint;
1496
        } else {
1497
            $maxW = $this->wPrint - $this->wCanhoto;
1498
        }
1499
        $w     = $maxW;
1500
        $h     = 7;
1501
        $texto = 'INFORMAÇÕES DO LOCAL DE ENTREGA';
1502
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1503
        $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...
1504
        //NOME / RAZÃO SOCIAL
1505
        $w     = round($maxW * 0.61, 0);
1506
        $w1    = $w;
1507
        $y     += 3;
1508
        $texto = 'NOME / RAZÃO SOCIAL';
1509
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1510
        $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...
1511
        $texto = '';
1512
        if ($this->entrega->getElementsByTagName("xNome")->item(0)) {
1513
            $texto = $this->entrega->getElementsByTagName("xNome")->item(0)->nodeValue;
1514
        }
1515
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1516
        if ($this->orientacao == 'P') {
1517
            $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...
1518
        } else {
1519
            $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...
1520
        }
1521
        //CNPJ / CPF
1522
        $x     += $w;
1523
        $w     = round($maxW * 0.23, 0);
1524
        $w2    = $w;
1525
        $texto = 'CNPJ / CPF';
1526
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1527
        $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...
1528
        //Pegando valor do CPF/CNPJ
1529
        if (! empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1530
            $texto = $this->formatField(
1531
                $this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1532
                "###.###.###/####-##"
1533
            );
1534
        } else {
1535
            $texto = ! empty($this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1536
                $this->formatField(
1537
                    $this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue,
1538
                    "###.###.###-##"
1539
                ) : '';
1540
        }
1541
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1542
        $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...
1543
        //INSCRIÇÃO ESTADUAL
1544
        $x     += $w;
1545
        $w     = $maxW - ($w1 + $w2);
1546
        $wx    = $w;
1547
        $texto = 'INSCRIÇÃO ESTADUAL';
1548
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1549
        $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...
1550
        $texto = '';
1551
        if ($this->entrega->getElementsByTagName("IE")->item(0)) {
1552
            $texto = $this->entrega->getElementsByTagName("IE")->item(0)->nodeValue;
1553
        }
1554
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1555
        if ($this->orientacao == 'P') {
1556
            $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...
1557
        } else {
1558
            $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...
1559
        }
1560
        //ENDEREÇO
1561
        $w     = round($maxW * 0.355, 0) + $wx;
1562
        $w1    = $w;
1563
        $y     += $h;
1564
        $x     = $oldX;
1565
        $texto = 'ENDEREÇO';
1566
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1567
        $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...
1568
        $texto = $this->entrega->getElementsByTagName("xLgr")->item(0)->nodeValue;
1569
        $texto .= ', ' . $this->entrega->getElementsByTagName("nro")->item(0)->nodeValue;
1570
        $texto .= $this->getTagValue($this->entrega, "xCpl", " - ");
1571
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1572
        $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...
1573
        //BAIRRO / DISTRITO
1574
        $x     += $w;
1575
        $w     = round($maxW * 0.335, 0);
1576
        $w2    = $w;
1577
        $texto = 'BAIRRO / DISTRITO';
1578
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1579
        $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...
1580
        $texto = $this->entrega->getElementsByTagName("xBairro")->item(0)->nodeValue;
1581
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1582
        $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...
1583
        //CEP
1584
        $x     += $w;
1585
        $w     = $maxW - ($w1 + $w2);
1586
        $texto = 'CEP';
1587
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1588
        $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...
1589
        $texto = ! empty($this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1590
            $this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1591
        $texto = $this->formatField($texto, "#####-###");
1592
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1593
        $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...
1594
        //MUNICÍPIO
1595
        $w     = round($maxW * 0.805, 0);
1596
        $w1    = $w;
1597
        $y     += $h;
1598
        $x     = $oldX;
1599
        $texto = 'MUNICÍPIO';
1600
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1601
        $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...
1602
        $texto = $this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue;
1603
        if (strtoupper(trim($texto)) == "EXTERIOR" && $this->entrega->getElementsByTagName("xPais")->length > 0) {
1604
            $texto .= " - " . $this->entrega->getElementsByTagName("xPais")->item(0)->nodeValue;
1605
        }
1606
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1607
        $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...
1608
        //UF
1609
        $x     += $w;
1610
        $w     = 8;
1611
        $texto = 'UF';
1612
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1613
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1614
        $texto = $this->entrega->getElementsByTagName("UF")->item(0)->nodeValue;
1615
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1616
        $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...
1617
        //FONE / FAX
1618
        $x     += $w;
1619
        $w     = $maxW - $w - $w1;
1620
        $texto = 'FONE / FAX';
1621
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1622
        $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...
1623
        $texto = ! empty($this->entrega->getElementsByTagName("fone")->item(0)->nodeValue) ?
1624
            $this->entrega->getElementsByTagName("fone")->item(0)->nodeValue : '';
1625
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1626
        $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...
1627
1628
        return ($y + $h);
1629
    } //fim da função localEntregaDANFE
1630
1631
    /**
1632
     * localretiradaDANFE
1633
     * Monta o campo com os dados do local de entrega na DANFE. (retrato e paisagem)
1634
     *
1635
     * @name   localretiradaDANFE
1636
     *
1637
     * @param number $x Posição horizontal canto esquerdo
1638
     * @param number $y Posição vertical canto superior
1639
     *
1640
     * @return number Posição vertical final
1641
     */
1642
    protected function localRetiradaDANFE($x = 0, $y = 0)
1643
    {
1644
        //####################################################################################
1645
        //LOCAL DE RETIRADA
1646
        $oldX = $x;
1647
        if ($this->orientacao == 'P') {
1648
            $maxW = $this->wPrint;
1649
        } else {
1650
            $maxW = $this->wPrint - $this->wCanhoto;
1651
        }
1652
        $w     = $maxW;
1653
        $h     = 7;
1654
        $texto = 'INFORMAÇÕES DO LOCAL DE RETIRADA';
1655
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1656
        $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...
1657
        //NOME / RAZÃO SOCIAL
1658
        $w     = round($maxW * 0.61, 0);
1659
        $w1    = $w;
1660
        $y     += 3;
1661
        $texto = 'NOME / RAZÃO SOCIAL';
1662
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1663
        $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...
1664
        $texto = '';
1665
        if ($this->retirada->getElementsByTagName("xNome")->item(0)) {
1666
            $texto = $this->retirada->getElementsByTagName("xNome")->item(0)->nodeValue;
1667
        }
1668
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1669
        if ($this->orientacao == 'P') {
1670
            $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...
1671
        } else {
1672
            $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...
1673
        }
1674
        //CNPJ / CPF
1675
        $x     += $w;
1676
        $w     = round($maxW * 0.23, 0);
1677
        $w2    = $w;
1678
        $texto = 'CNPJ / CPF';
1679
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1680
        $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...
1681
        //Pegando valor do CPF/CNPJ
1682
        if (! empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1683
            $texto = $this->formatField(
1684
                $this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1685
                "###.###.###/####-##"
1686
            );
1687
        } else {
1688
            $texto = ! empty($this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1689
                $this->formatField(
1690
                    $this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue,
1691
                    "###.###.###-##"
1692
                ) : '';
1693
        }
1694
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1695
        $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...
1696
        //INSCRIÇÃO ESTADUAL
1697
        $x     += $w;
1698
        $w     = $maxW - ($w1 + $w2);
1699
        $wx    = $w;
1700
        $texto = 'INSCRIÇÃO ESTADUAL';
1701
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1702
        $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...
1703
        $texto = '';
1704
        if ($this->retirada->getElementsByTagName("IE")->item(0)) {
1705
            $texto = $this->retirada->getElementsByTagName("IE")->item(0)->nodeValue;
1706
        }
1707
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1708
        if ($this->orientacao == 'P') {
1709
            $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...
1710
        } else {
1711
            $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...
1712
        }
1713
        //ENDEREÇO
1714
        $w     = round($maxW * 0.355, 0) + $wx;
1715
        $w1    = $w;
1716
        $y     += $h;
1717
        $x     = $oldX;
1718
        $texto = 'ENDEREÇO';
1719
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1720
        $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...
1721
        $texto = $this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue;
1722
        $texto .= ', ' . $this->retirada->getElementsByTagName("nro")->item(0)->nodeValue;
1723
        $texto .= $this->getTagValue($this->retirada, "xCpl", " - ");
1724
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1725
        $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...
1726
        //BAIRRO / DISTRITO
1727
        $x     += $w;
1728
        $w     = round($maxW * 0.335, 0);
1729
        $w2    = $w;
1730
        $texto = 'BAIRRO / DISTRITO';
1731
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1732
        $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...
1733
        $texto = $this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue;
1734
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1735
        $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...
1736
        //CEP
1737
        $x     += $w;
1738
        $w     = $maxW - ($w1 + $w2);
1739
        $texto = 'CEP';
1740
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1741
        $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...
1742
        $texto = ! empty($this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1743
            $this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1744
        $texto = $this->formatField($texto, "#####-###");
1745
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1746
        $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...
1747
        //MUNICÍPIO
1748
        $w     = round($maxW * 0.805, 0);
1749
        $w1    = $w;
1750
        $y     += $h;
1751
        $x     = $oldX;
1752
        $texto = 'MUNICÍPIO';
1753
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1754
        $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...
1755
        $texto = $this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue;
1756
        if (strtoupper(trim($texto)) == "EXTERIOR" && $this->retirada->getElementsByTagName("xPais")->length > 0) {
1757
            $texto .= " - " . $this->retirada->getElementsByTagName("xPais")->item(0)->nodeValue;
1758
        }
1759
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1760
        $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...
1761
        //UF
1762
        $x     += $w;
1763
        $w     = 8;
1764
        $texto = 'UF';
1765
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1766
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

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