Passed
Pull Request — master (#392)
by Eduardo
02:49
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
        ) {
855
            return ['status' => false, 'message' => 'NFe CANCELADA'];
856
        }
857
858
        if ($cStat == '110' ||
859
            $cStat == '301' ||
860
            $cStat == '302'
861
862
        ) {
863
            return ['status' => false, 'message' => 'NFe DENEGADA'];
864
        }
865
866
        return ['status' => true, 'message' => ''];
867
    }
868
869
    protected function notaDPEC()
870
    {
871
        return ! empty($this->numdepec);
872
    }
873
874
    /**
875
     *header
876
     * Monta o cabelhalho da DANFE (retrato e paisagem)
877
     *
878
     * @param number $x      Posição horizontal inicial, canto esquerdo
879
     * @param number $y      Posição vertical inicial, canto superior
880
     * @param number $pag    Número da Página
881
     * @param number $totPag Total de páginas
882
     *
883
     * @return number Posição vertical final
884
     */
885
    protected function header($x = 0, $y = 0, $pag = '1', $totPag = '1')
886
    {
887
        $oldX = $x;
888
        $oldY = $y;
889
        if ($this->orientacao == 'P') {
890
            $maxW = $this->wPrint;
891
        } else {
892
            if ($pag == 1) { // primeira página
893
                $maxW = $this->wPrint - $this->wCanhoto;
894
            } else { // páginas seguintes
895
                $maxW = $this->wPrint;
896
            }
897
        }
898
        //####################################################################################
899
        //coluna esquerda identificação do emitente
900
        $w = round($maxW * 0.41, 0);
901
        if ($this->orientacao == 'P') {
902
            $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I'];
903
        } else {
904
            $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
905
        }
906
        $w1   = $w;
907
        $h    = 32;
908
        $oldY += $h;
909
        $this->pdf->textBox($x, $y, $w, $h);
910
        $texto = 'IDENTIFICAÇÃO DO EMITENTE';
911
        $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...
912
        //estabelecer o alinhamento
913
        //pode ser left L, center C, right R, full logo L
914
        //se for left separar 1/3 da largura para o tamanho da imagem
915
        //os outros 2/3 serão usados para os dados do emitente
916
        //se for center separar 1/2 da altura para o logo e 1/2 para os dados
917
        //se for right separa 2/3 para os dados e o terço seguinte para o logo
918
        //se não houver logo centraliza dos dados do emitente
919
        // coloca o logo
920
        if (! empty($this->logomarca)) {
921
            $logoInfo = getimagesize($this->logomarca);
922
            //largura da imagem em mm
923
            $logoWmm = ($logoInfo[0] / 72) * 25.4;
924
            //altura da imagem em mm
925
            $logoHmm = ($logoInfo[1] / 72) * 25.4;
926
            if ($this->logoAlign == 'L') {
927
                $nImgW = round($w / 3, 0);
928
                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
929
                $xImg  = $x + 1;
930
                $yImg  = round(($h - $nImgH) / 2, 0) + $y;
931
                //estabelecer posições do texto
932
                $x1 = round($xImg + $nImgW + 1, 0);
933
                $y1 = round($h / 3 + $y, 0);
934
                $tw = round(2 * $w / 3, 0);
935
            } elseif ($this->logoAlign == 'C') {
936
                $nImgH = round($h / 3, 0);
937
                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
938
                $xImg  = round(($w - $nImgW) / 2 + $x, 0);
939
                $yImg  = $y + 3;
940
                $x1    = $x;
941
                $y1    = round($yImg + $nImgH + 1, 0);
942
                $tw    = $w;
943
            } elseif ($this->logoAlign == 'R') {
944
                $nImgW = round($w / 3, 0);
945
                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
946
                $xImg  = round($x + ($w - (1 + $nImgW)), 0);
947
                $yImg  = round(($h - $nImgH) / 2, 0) + $y;
948
                $x1    = $x;
949
                $y1    = round($h / 3 + $y, 0);
950
                $tw    = round(2 * $w / 3, 0);
951
            } elseif ($this->logoAlign == 'F') {
952
                $nImgH = round($h - 5, 0);
953
                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
954
                $xImg  = round(($w - $nImgW) / 2 + $x, 0);
955
                $yImg  = $y + 3;
956
                $x1    = $x;
957
                $y1    = round($yImg + $nImgH + 1, 0);
958
                $tw    = $w;
959
            }
960
            $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...
961
            $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...
962
        } else {
963
            $x1 = $x;
964
            $y1 = round($h / 3 + $y, 0);
965
            $tw = $w;
966
        }
967
        // monta as informações apenas se diferente de full logo
968
        if ($this->logoAlign !== 'F') {
969
            //Nome emitente
970
            $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B'];
971
            $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
972
            $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...
973
            //endereço
974
            $y1     = $y1 + 5;
975
            $aFont  = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
976
            $fone   = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
977
                ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
978
                : '';
979
            $lgr    = $this->getTagValue($this->enderEmit, "xLgr");
980
            $nro    = $this->getTagValue($this->enderEmit, "nro");
981
            $cpl    = $this->getTagValue($this->enderEmit, "xCpl", " - ");
982
            $bairro = $this->getTagValue($this->enderEmit, "xBairro");
983
            $CEP    = $this->getTagValue($this->enderEmit, "CEP");
984
            $CEP    = $this->formatField($CEP, "#####-###");
985
            $mun    = $this->getTagValue($this->enderEmit, "xMun");
986
            $UF     = $this->getTagValue($this->enderEmit, "UF");
987
            $texto  = $lgr . ", " . $nro . $cpl . "\n" . $bairro . " - "
988
                . $CEP . "\n" . $mun . " - " . $UF . " "
989
                . "Fone/Fax: " . $fone;
990
            $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...
991
        }
992
993
        //####################################################################################
994
        //coluna central Danfe
995
        $x  += $w;
996
        $w  = round($maxW * 0.17, 0);//35;
997
        $w2 = $w;
998
        $h  = 32;
999
        $this->pdf->textBox($x, $y, $w, $h);
1000
1001
        $texto = "DANFE";
1002
        $aFont = ['font' => $this->fontePadrao, 'size' => 14, 'style' => 'B'];
1003
        $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...
1004
        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
1005
        $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
1006
        $h     = 20;
1007
        $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...
1008
1009
        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
1010
        $texto = '0 - ENTRADA';
1011
        $y1    = $y + 14;
1012
        $h     = 8;
1013
        $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...
1014
        $texto = '1 - SAÍDA';
1015
        $y1    = $y + 17;
1016
        $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...
1017
        //tipo de nF
1018
        $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B'];
1019
        $y1    = $y + 13;
1020
        $h     = 7;
1021
        $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
1022
        $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...
1023
        //numero da NF
1024
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1025
        $y1    = $y + 20;
1026
        $numNF = str_pad(
1027
            $this->ide->getElementsByTagName('nNF')->item(0)->nodeValue,
1028
            9,
1029
            "0",
1030
            STR_PAD_LEFT
1031
        );
1032
        $numNF = $this->formatField($numNF, "###.###.###");
1033
        $texto = "Nº. " . $numNF;
1034
        $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...
1035
        //Série
1036
        $y1    = $y + 23;
1037
        $serie = str_pad(
1038
            $this->ide->getElementsByTagName('serie')->item(0)->nodeValue,
1039
            3,
1040
            "0",
1041
            STR_PAD_LEFT
1042
        );
1043
        $texto = "Série " . $serie;
1044
        $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...
1045
        //numero paginas
1046
        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'I'];
1047
        $y1    = $y + 26;
1048
        $texto = "Folha " . $pag . "/" . $totPag;
1049
        $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...
1050
1051
        //####################################################################################
1052
        //coluna codigo de barras
1053
        $x  += $w;
1054
        $w  = ($maxW - $w1 - $w2);//85;
1055
        $w3 = $w;
1056
        $h  = 32;
1057
        $this->pdf->textBox($x, $y, $w, $h);
1058
        $this->pdf->setFillColor(0, 0, 0);
1059
        $chave_acesso = str_replace('NFe', '', $this->infNFe->getAttribute("Id"));
1060
        $bW           = 75;
1061
        $bH           = 12;
1062
        //codigo de barras
1063
        $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
1064
        //linhas divisorias
1065
        $this->pdf->line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH);
1066
        $this->pdf->line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH);
1067
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1068
        $y1    = $y + 4 + $bH;
1069
        $h     = 7;
1070
        $texto = 'CHAVE DE ACESSO';
1071
        $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...
1072
        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
1073
        $y1    = $y + 8 + $bH;
1074
        $texto = $this->formatField($chave_acesso, $this->formatoChave);
1075
        $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...
1076
        $y1                = $y + 12 + $bH;
1077
        $aFont             = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
1078
        $chaveContingencia = "";
1079
        if ($this->notaDpec()) {
1080
            $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC';
1081
        } else {
1082
            $cabecalhoProtoAutorizacao = 'PROTOCOLO DE AUTORIZAÇÃO DE USO';
1083
        }
1084
        if (($this->tpEmis == 2 || $this->tpEmis == 5) && ! $this->notaDpec()) {
1085
            $cabecalhoProtoAutorizacao = "DADOS DA NF-E";
1086
            $chaveContingencia         = $this->geraChaveAdicionalDeContingencia();
1087
            $this->pdf->setFillColor(0, 0, 0);
1088
            //codigo de barras
1089
            $this->pdf->code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2);
1090
        } else {
1091
            $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1092
            $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...
1093
            $y1    = $y + 16 + $bH;
1094
            $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1095
            $this->pdf->textBox(
1096
                $x + 2,
1097
                $y1,
1098
                $w - 2,
1099
                $h,
1100
                $texto,
1101
                $aFont,
1102
                'T',
1103
                'C',
1104
                0,
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

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

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1427
        $texto = $this->dest->getElementsByTagName("UF")->item(0)->nodeValue;
1428
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1429
        $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...
1430
        //FONE / FAX
1431
        $x     += $w;
1432
        $w     = round(($maxW - $w1 - $wx - 8) / 2, 0);
1433
        $w3    = $w;
1434
        $texto = 'FONE / FAX';
1435
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1436
        $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...
1437
        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue)
1438
            ? $this->dest->getElementsByTagName("fone")->item(0)->nodeValue
1439
            : '';
1440
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1441
        $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...
1442
        //INSCRIÇÃO ESTADUAL
1443
        $x     += $w;
1444
        $w     = $maxW - $w1 - $wx - 8 - $w3;
1445
        $texto = 'INSCRIÇÃO ESTADUAL';
1446
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1447
        $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...
1448
        $IE    = $this->dest->getElementsByTagName("IE");
1449
        $texto = ($IE && $IE->length > 0) ? $IE->item(0)->nodeValue : '';
1450
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1451
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

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

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

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

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

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

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1766
        $texto = $this->retirada->getElementsByTagName("UF")->item(0)->nodeValue;
1767
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1768
        $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...
1769
        //FONE / FAX
1770
        $x     += $w;
1771
        $w     = $maxW - $w - $w1;
1772
        $texto = 'FONE / FAX';
1773
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1774
        $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...
1775
        $texto = ! empty($this->retirada->getElementsByTagName("fone")->item(0)->nodeValue) ?
1776
            $this->retirada->getElementsByTagName("fone")->item(0)->nodeValue : '';
1777
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
1778
        $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...
1779
1780
        return ($y + $h);
1781
    } //fim da função localRetiradaDANFE
1782
1783
    /**
1784
     * getTextoFatura
1785
     * Gera a String do Texto da Fatura
1786
     *
1787
     * @name   getTextoFatura
1788
     * @return uma String com o texto ou "";
1789
     */
1790
    protected function getTextoFatura()
1791
    {
1792
        if (isset($this->cobr)) {
1793
            $fat = $this->cobr->getElementsByTagName("fat")->item(0);
1794
            if (isset($fat)) {
1795
                if (! empty($this->getTagValue($this->ide, "indPag"))) {
1796
                    $textoIndPag = "";
1797
                    $indPag      = $this->getTagValue($this->ide, "indPag");
1798
                    if ($indPag === "0") {
1799
                        $textoIndPag = "Pagamento à Vista - ";
1800
                    } elseif ($indPag === "1") {
1801
                        $textoIndPag = "Pagamento à Prazo - ";
1802
                    }
1803
                    $nFat  = $this->getTagValue($fat, "nFat", "Fatura: ");
1804
                    $vOrig = $this->getTagValue($fat, "vOrig", " Valor Original: ");
1805
                    $vDesc = $this->getTagValue($fat, "vDesc", " Desconto: ");
1806
                    $vLiq  = $this->getTagValue($fat, "vLiq", " Valor Líquido: ");
1807
                    $texto = $textoIndPag . $nFat . $vOrig . $vDesc . $vLiq;
1808
1809
                    return $texto;
1810
                } else {
1811
                    $pag = $this->dom->getElementsByTagName("pag");
1812
                    if ($tPag = $this->getTagValue($pag->item(0), "tPag")) {
1813
                        return $this->tipoPag($tPag);
1814
                    }
1815
                }
1816
            }
1817
        }
1818
1819
        return "";
1820
    }
1821
1822
    /**
1823
     * sizeExtraTextoFatura
1824
     * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata.
1825
     *
1826
     * @name   sizeExtraTextoFatura
1827
     * @return integer
1828
     */
1829
    protected function sizeExtraTextoFatura()
1830
    {
1831
        $textoFatura = $this->getTextoFatura();
1832
        //verificar se existem duplicatas
1833
        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...
1834
            return 10;
1835
        }
1836
1837
        return 0;
1838
    }
1839
1840
    /**
1841
     * fatura
1842
     * Monta o campo de duplicatas da DANFE (retrato e paisagem)
1843
     *
1844
     * @name   fatura
1845
     *
1846
     * @param number $x Posição horizontal canto esquerdo
1847
     * @param number $y Posição vertical canto superior
1848
     *
1849
     * @return number Posição vertical final
1850
     */
1851
    protected function fatura($x, $y)
1852
    {
1853
        $linha       = 1;
1854
        $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...
1855
        $oldx        = $x;
1856
        $textoFatura = $this->getTextoFatura();
1857
        //verificar se existem duplicatas
1858
        if ($this->dup->length > 0 || $textoFatura !== "") {
1859
            //#####################################################################
1860
            //FATURA / DUPLICATA
1861
            $texto = $y . " - FATURA / DUPLICATA";
1862
            if ($this->orientacao == 'P') {
1863
                $w = $this->wPrint;
1864
            } else {
1865
                $w = 271;
1866
            }
1867
            $h     = 8;
1868
            $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1869
            $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...
1870
            $y       += 3;
1871
            $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...
1872
            $dupcont = 0;
1873
            $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...
1874
            if ($nFat > 7) {
1875
                $myH = 6;
1876
                $myW = $this->wPrint;
1877
                if ($this->orientacao == 'L') {
1878
                    $myW -= $this->wCanhoto;
1879
                }
1880
                $aFont = ['font' => $this->fontePadrao, 'size' => 9, 'style' => ''];
1881
                $texto = "Existem mais de 7 duplicatas registradas, portanto não "
1882
                    . "serão exibidas, confira diretamente pelo XML.";
1883
                $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...
1884
1885
                return ($y + $h - 3);
1886
            }
1887
            if ($textoFatura !== "" && $this->exibirTextoFatura) {
1888
                $myH = 6;
1889
                $myW = $this->wPrint;
1890
                if ($this->orientacao == 'L') {
1891
                    $myW -= $this->wCanhoto;
1892
                }
1893
                $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
1894
                $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...
1895
                $y += $myH + 1;
1896
            }
1897
            if ($this->orientacao == 'P') {
1898
                $w = round($this->wPrint / 7.018, 0) - 1;
1899
            } else {
1900
                $w = 28;
1901
            }
1902
            $increm = 1;
1903
            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...
1904
                $nDup  = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue)
1905
                    ? $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue
1906
                    : '';
1907
                $dDup  = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
1908
                    ? $this->ymdTodmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
1909
                    : '';
1910
                $vDup  = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue)
1911
                    ? 'R$ ' . number_format(
1912
                        $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
1913
                        2,
1914
                        ",",
1915
                        "."
1916
                    )
1917
                    : '';
1918
                $h     = 8;
1919
                $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...
1920
                if ($nDup != '0' && $nDup != '') {
1921
                    $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1922
                    $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...
1923
                    $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1924
                    $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...
1925
                } else {
1926
                    $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1927
                    $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...
1928
                }
1929
                $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1930
                $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...
1931
                $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1932
                $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...
1933
                $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
1934
                $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...
1935
                $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1936
                $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...
1937
                $x       += $w + $increm;
1938
                $dupcont += 1;
1939
                if ($this->orientacao == 'P') {
1940
                    $maxDupCont = 6;
1941
                } else {
1942
                    $maxDupCont = 8;
1943
                }
1944
                if ($dupcont > $maxDupCont) {
1945
                    $y       += 9;
1946
                    $x       = $oldx;
1947
                    $dupcont = 0;
1948
                    $linha   += 1;
1949
                }
1950
                if ($linha == 5) {
1951
                    $linha = 4;
1952
                    break;
1953
                }
1954
            }
1955
            if ($dupcont == 0) {
1956
                $y -= 9;
1957
                $linha --;
1958
            }
1959
1960
            return ($y + $h);
1961
        } else {
1962
            $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...
1963
1964
            return ($y - 2);
1965
        }
1966
    }
1967
1968
    /**
1969
     * pagamento
1970
     * Monta o campo de pagamentos da DANFE (retrato e paisagem) (foi baseada na fatura)
1971
     *
1972
     * @name   pagamento
1973
     *
1974
     * @param number $x Posição horizontal canto esquerdo
1975
     * @param number $y Posição vertical canto superior
1976
     *
1977
     * @return number Posição vertical final
1978
     */
1979
    protected function pagamento($x, $y)
1980
    {
1981
        $linha = 1;
1982
        $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...
1983
        $oldx  = $x;
1984
        //verificar se existem cobranças definidas
1985
        if (isset($this->detPag) && $this->detPag->length > 0) {
1986
            //#####################################################################
1987
            //Tipo de pagamento
1988
            $texto = "PAGAMENTO";
1989
            if ($this->orientacao == 'P') {
1990
                $w = $this->wPrint;
1991
            } else {
1992
                $w = 271;
1993
            }
1994
            $h     = 8;
1995
            $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
1996
            $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...
1997
            $y       += 3;
1998
            $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...
1999
            $dupcont = 0;
2000
            if ($this->orientacao == 'P') {
2001
                $w = round($this->wPrint / 7.018, 0) - 1;
2002
            } else {
2003
                $w = 28;
2004
            }
2005
            if ($this->orientacao == 'P') {
2006
                $maxDupCont = 6;
2007
            } else {
2008
                $maxDupCont = 8;
2009
            }
2010
            $increm         = 1;
2011
            $formaPagamento = [
2012
                '01' => 'Dinheiro',
2013
                '02' => 'Cheque',
2014
                '03' => 'Cartão de Crédito',
2015
                '04' => 'Cartão de Débito',
2016
                '05' => 'Crédito Loja',
2017
                '10' => 'Vale Alimentação',
2018
                '11' => 'Vale Refeição',
2019
                '12' => 'Vale Presente',
2020
                '13' => 'Vale Combustível',
2021
                '14' => 'Duplicata Mercantil',
2022
                '15' => 'Boleto',
2023
                '90' => 'Sem pagamento',
2024
                '99' => 'Outros'
2025
            ];
2026
            $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...
2027
                '01' => 'Visa',
2028
                '02' => 'Mastercard',
2029
                '03' => 'American',
2030
                '04' => 'Sorocred',
2031
                '05' => 'Diners',
2032
                '06' => 'Elo',
2033
                '07' => 'Hipercard',
2034
                '08' => 'Aura',
2035
                '09' => 'Cabal',
2036
                '99' => 'Outros'
2037
            ];
2038
            foreach ($this->detPag as $k => $d) {
2039
                $fPag  = ! empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
2040
                    ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue
2041
                    : '0';
2042
                $vPag  = ! empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
2043
                    ? 'R$ ' . number_format(
2044
                        $this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue,
2045
                        2,
2046
                        ",",
2047
                        "."
2048
                    )
2049
                    : '';
2050
                $h     = 6;
2051
                $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...
2052
                if (isset($formaPagamento[$fPag])) {
2053
                    /*Exibir Item sem pagamento*/
2054
                    if ($fPag == '90') {
2055
                        continue;
2056
                    }
2057
                    $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2058
                    $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...
2059
                    $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2060
                    $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...
2061
                } else {
2062
                    $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
2063
                    $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...
2064
                }
2065
                $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2066
                $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...
2067
                $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2068
                $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...
2069
                $x       += $w + $increm;
2070
                $dupcont += 1;
2071
2072
                if ($dupcont > $maxDupCont) {
2073
                    $y       += 9;
2074
                    $x       = $oldx;
2075
                    $dupcont = 0;
2076
                    $linha   += 1;
2077
                }
2078
                if ($linha == 5) {
2079
                    $linha = 4;
2080
                    break;
2081
                }
2082
            }
2083
            if ($dupcont == 0) {
2084
                $y -= 9;
2085
                $linha --;
2086
            }
2087
2088
            return ($y + $h);
2089
        } else {
2090
            $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...
2091
2092
            return ($y - 2);
2093
        }
2094
    } //fim da função pagamento
2095
2096
    /**
2097
     * impostoHelper
2098
     * Auxilia a montagem dos campos de impostos e totais da DANFE
2099
     *
2100
     * @name   impostoHelper
2101
     *
2102
     * @param float $x Posição horizontal canto esquerdo
2103
     * @param float $y Posição vertical canto superior
2104
     * @param float $w Largura do campo
2105
     * @param float $h Altura do campo
2106
     * @param float $h Título do campo
2107
     * @param float $h Valor do imposto
2108
     *
2109
     * @return float Sugestão do $x do próximo imposto
2110
     */
2111
    protected function impostoHelper($x, $y, $w, $h, $titulo, $campoImposto)
2112
    {
2113
        $valorImposto = '0,00';
2114
        $the_field    = $this->ICMSTot->getElementsByTagName($campoImposto)->item(0);
2115
        if (isset($the_field)) {
2116
            $the_value = $the_field->nodeValue;
2117
            if (! empty($the_value)) {
2118
                $valorImposto = number_format($the_value, 2, ",", ".");
2119
            }
2120
        }
2121
2122
        $fontTitulo = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2123
        $fontValor  = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2124
        $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...
2125
        $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...
2126
2127
        $next_x = $x + $w;
2128
2129
        return $next_x;
2130
    }
2131
2132
    /**
2133
     * imposto
2134
     * Monta o campo de impostos e totais da DANFE (retrato e paisagem)
2135
     *
2136
     * @param number $x Posição horizontal canto esquerdo
2137
     * @param number $y Posição vertical canto superior
2138
     *
2139
     * @return number Posição vertical final
2140
     */
2141
    protected function imposto($x, $y)
2142
    {
2143
        $x_inicial = $x;
2144
        //#####################################################################
2145
        $campos_por_linha = 9;
2146
        if (! $this->exibirPIS) {
2147
            $campos_por_linha --;
2148
        }
2149
        if (! $this->exibirIcmsInterestadual) {
2150
            $campos_por_linha -= 2;
2151
        }
2152
2153
        if ($this->orientacao == 'P') {
2154
            $maxW       = $this->wPrint;
2155
            $title_size = 31;
2156
        } else {
2157
            $maxW       = $this->wPrint - $this->wCanhoto;
2158
            $title_size = 40;
2159
        }
2160
        $w = $maxW / $campos_por_linha;
2161
2162
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2163
        $texto = "CÁLCULO DO IMPOSTO";
2164
        $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...
2165
        $y += 3;
2166
        $h = 7;
2167
2168
        $x = $this->impostoHelper($x, $y, $w, $h, "BASE DE CÁLC. DO ICMS", "vBC");
2169
        $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DO ICMS", "vICMS");
2170
        $x = $this->impostoHelper($x, $y, $w, $h, "BASE DE CÁLC. ICMS S.T.", "vBCST");
2171
        $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DO ICMS SUBST.", "vST");
2172
        $x = $this->impostoHelper($x, $y, $w, $h, "V. IMP. IMPORTAÇÃO", "vII");
2173
2174
        if ($this->exibirIcmsInterestadual) {
2175
            $x = $this->impostoHelper($x, $y, $w, $h, "V. ICMS UF REMET.", "vICMSUFRemet");
2176
            $x = $this->impostoHelper($x, $y, $w, $h, "V. FCP UF DEST.", "vFCPUFDest");
2177
        }
2178
2179
        if ($this->exibirPIS) {
2180
            $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DO PIS", "vPIS");
2181
        }
2182
2183
        $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...
2184
2185
        //
2186
2187
        $y += $h;
2188
        $x = $x_inicial;
2189
2190
        $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DO FRETE", "vFrete");
2191
        $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DO SEGURO", "vSeg");
2192
        $x = $this->impostoHelper($x, $y, $w, $h, "DESCONTO", "vDesc");
2193
        $x = $this->impostoHelper($x, $y, $w, $h, "OUTRAS DESPESAS", "vOutro");
2194
        $x = $this->impostoHelper($x, $y, $w, $h, "VALOR TOTAL IPI", "vIPI");
2195
2196
        if ($this->exibirIcmsInterestadual) {
2197
            $x = $this->impostoHelper($x, $y, $w, $h, "V. ICMS UF DEST.", "vICMSUFDest");
2198
            $x = $this->impostoHelper($x, $y, $w, $h, "V. TOT. TRIB.", "vTotTrib");
2199
        }
2200
        if ($this->exibirPIS) {
2201
            $x = $this->impostoHelper($x, $y, $w, $h, "VALOR DA COFINS", "vCOFINS");
2202
        }
2203
        $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...
2204
2205
        return ($y + $h);
2206
    } //fim imposto
2207
2208
    /**
2209
     * transporte
2210
     * Monta o campo de transportes da DANFE (retrato e paisagem)
2211
     *
2212
     * @name   transporte
2213
     *
2214
     * @param float $x Posição horizontal canto esquerdo
2215
     * @param float $y Posição vertical canto superior
2216
     *
2217
     * @return float Posição vertical final
2218
     */
2219
    protected function transporte($x, $y)
2220
    {
2221
        $oldX = $x;
2222
        if ($this->orientacao == 'P') {
2223
            $maxW = $this->wPrint;
2224
        } else {
2225
            $maxW = $this->wPrint - $this->wCanhoto;
2226
        }
2227
        //#####################################################################
2228
        //TRANSPORTADOR / VOLUMES TRANSPORTADOS
2229
        $texto = "TRANSPORTADOR / VOLUMES TRANSPORTADOS";
2230
        $w     = $maxW;
2231
        $h     = 7;
2232
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2233
        $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...
2234
        //NOME / RAZÃO SOCIAL
2235
        $w1    = $maxW * 0.29;
2236
        $y     += 3;
2237
        $texto = 'NOME / RAZÃO SOCIAL';
2238
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2239
        $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...
2240
        if (isset($this->transporta)) {
2241
            $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue)
2242
                ? $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue
2243
                : '';
2244
        } else {
2245
            $texto = '';
2246
        }
2247
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2248
        $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...
2249
        //FRETE POR CONTA
2250
        $x     += $w1;
2251
        $w2    = $maxW * 0.15;
2252
        $texto = 'FRETE';
2253
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2254
        $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...
2255
        $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue)
2256
            ? $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue
2257
            : '0';
2258
        switch ($tipoFrete) {
2259
            case 0:
2260
                $texto = "0-Por conta do Rem";
2261
                break;
2262
            case 1:
2263
                $texto = "1-Por conta do Dest";
2264
                break;
2265
            case 2:
2266
                $texto = "2-Por conta de Terceiros";
2267
                break;
2268
            case 3:
2269
                $texto = "3-Próprio por conta do Rem";
2270
                break;
2271
            case 4:
2272
                $texto = "4-Próprio por conta do Dest";
2273
                break;
2274
            case 9:
2275
                $texto = "9-Sem Transporte";
2276
                break;
2277
        }
2278
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2279
        $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...
2280
        //CÓDIGO ANTT
2281
        $x     += $w2;
2282
        $texto = 'CÓDIGO ANTT';
2283
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2284
        $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...
2285
        if (isset($this->veicTransp)) {
2286
            $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue)
2287
                ? $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue
2288
                : '';
2289
        } else {
2290
            $texto = '';
2291
        }
2292
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2293
        $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...
2294
        //PLACA DO VEÍC
2295
        $x     += $w2;
2296
        $texto = 'PLACA DO VEÍCULO';
2297
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2298
        $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...
2299
        if (isset($this->veicTransp)) {
2300
            $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue)
2301
                ? $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue
2302
                : '';
2303
        } elseif (isset($this->reboque)) {
2304
            $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue)
2305
                ? $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue
2306
                : '';
2307
        } else {
2308
            $texto = '';
2309
        }
2310
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2311
        $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...
2312
        //UF
2313
        $x     += $w2;
2314
        $w3    = round($maxW * 0.04, 0);
2315
        $texto = 'UF';
2316
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2317
        $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...
2318
        if (isset($this->veicTransp)) {
2319
            $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue)
2320
                ? $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue
2321
                : '';
2322
        } elseif (isset($this->reboque)) {
2323
            $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue)
2324
                ? $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue
2325
                : '';
2326
        } else {
2327
            $texto = '';
2328
        }
2329
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2330
        $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...
2331
        //CNPJ / CPF
2332
        $x     += $w3;
2333
        $w     = $maxW - ($w1 + 3 * $w2 + $w3);
2334
        $texto = 'CNPJ / CPF';
2335
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2336
        $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...
2337
        if (isset($this->transporta)) {
2338
            $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue)
2339
                ? $this->formatField(
2340
                    $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,
2341
                    "##.###.###/####-##"
2342
                )
2343
                : '';
2344
            if ($texto == '') {
2345
                $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue)
2346
                    ? $this->formatField(
2347
                        $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue,
2348
                        "###.###.###-##"
2349
                    )
2350
                    : '';
2351
            }
2352
        } else {
2353
            $texto = '';
2354
        }
2355
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2356
        $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...
2357
        //#####################################################################
2358
        //ENDEREÇO
2359
        $y     += $h;
2360
        $x     = $oldX;
2361
        $h     = 7;
2362
        $w1    = $maxW * 0.44;
2363
        $texto = 'ENDEREÇO';
2364
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2365
        $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...
2366
        if (isset($this->transporta)) {
2367
            $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue)
2368
                ? $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue
2369
                : '';
2370
        } else {
2371
            $texto = '';
2372
        }
2373
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2374
        $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...
2375
        //MUNICÍPIO
2376
        $x     += $w1;
2377
        $w2    = round($maxW * 0.30, 0);
2378
        $texto = 'MUNICÍPIO';
2379
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2380
        $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...
2381
        if (isset($this->transporta)) {
2382
            $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue)
2383
                ? $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue
2384
                : '';
2385
        } else {
2386
            $texto = '';
2387
        }
2388
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2389
        $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...
2390
        //UF
2391
        $x     += $w2;
2392
        $w3    = round($maxW * 0.04, 0);
2393
        $texto = 'UF';
2394
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2395
        $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...
2396
        if (isset($this->transporta)) {
2397
            $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue)
2398
                ? $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue
2399
                : '';
2400
        } else {
2401
            $texto = '';
2402
        }
2403
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2404
        $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...
2405
        //INSCRIÇÃO ESTADUAL
2406
        $x     += $w3;
2407
        $w     = $maxW - ($w1 + $w2 + $w3);
2408
        $texto = 'INSCRIÇÃO ESTADUAL';
2409
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2410
        $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...
2411
        $texto = '';
2412
        if (isset($this->transporta)) {
2413
            if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2414
                $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue;
2415
            }
2416
        }
2417
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2418
        $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...
2419
        //Tratar Multiplos volumes
2420
        $volumes     = $this->transp->getElementsByTagName('vol');
2421
        $quantidade  = 0;
2422
        $especie     = '';
2423
        $marca       = '';
2424
        $numero      = '';
2425
        $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...
2426
        $pesoBruto   = 0;
2427
        $pesoLiquido = 0;
2428
        foreach ($volumes as $volume) {
2429
            $quantidade  += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2430
                $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0;
2431
            $pesoBruto   += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2432
                $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0;
2433
            $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2434
                $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0;
2435
            $texto       = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2436
                $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';
2437
            if ($texto != $especie && $especie != '') {
2438
                //tem várias especies
2439
                $especie = 'VARIAS';
2440
            } else {
2441
                $especie = $texto;
2442
            }
2443
            $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue)
2444
                ? $this->transp->getElementsByTagName("marca")->item(0)->nodeValue
2445
                : '';
2446
            if ($texto != $marca && $marca != '') {
2447
                //tem várias especies
2448
                $marca = 'VARIAS';
2449
            } else {
2450
                $marca = $texto;
2451
            }
2452
            $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue)
2453
                ? $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue
2454
                : '';
2455
            if ($texto != $numero && $numero != '') {
2456
                //tem várias especies
2457
                $numero = 'VARIOS';
2458
            } else {
2459
                $numero = $texto;
2460
            }
2461
        }
2462
2463
        //#####################################################################
2464
        //QUANTIDADE
2465
        $y     += $h;
2466
        $x     = $oldX;
2467
        $h     = 7;
2468
        $w1    = round($maxW * 0.10, 0);
2469
        $texto = 'QUANTIDADE';
2470
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2471
        $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...
2472
        if (! empty($quantidade)) {
2473
            $texto = $quantidade;
2474
            $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2475
            $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...
2476
        }
2477
        //ESPÉCIE
2478
        $x     += $w1;
2479
        $w2    = round($maxW * 0.17, 0);
2480
        $texto = 'ESPÉCIE';
2481
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2482
        $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...
2483
        $texto = $especie;
2484
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2485
        $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...
2486
        //MARCA
2487
        $x     += $w2;
2488
        $texto = 'MARCA';
2489
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2490
        $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...
2491
        $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2492
            $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2493
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2494
        $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...
2495
        //NUMERAÇÃO
2496
        $x     += $w2;
2497
        $texto = 'NUMERAÇÃO';
2498
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2499
        $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...
2500
        $texto = $numero;
2501
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2502
        $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...
2503
        //PESO BRUTO
2504
        $x     += $w2;
2505
        $w3    = round($maxW * 0.20, 0);
2506
        $texto = 'PESO BRUTO';
2507
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2508
        $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...
2509
        if (is_numeric($pesoBruto) && $pesoBruto > 0) {
2510
            $texto = number_format($pesoBruto, 3, ",", ".");
2511
        } else {
2512
            $texto = '';
2513
        }
2514
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2515
        $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...
2516
        //PESO LÍQUIDO
2517
        $x     += $w3;
2518
        $w     = $maxW - ($w1 + 3 * $w2 + $w3);
2519
        $texto = 'PESO LÍQUIDO';
2520
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2521
        $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...
2522
        if (is_numeric($pesoLiquido) && $pesoLiquido > 0) {
2523
            $texto = number_format($pesoLiquido, 3, ",", ".");
2524
        } else {
2525
            $texto = '';
2526
        }
2527
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
2528
        $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...
2529
2530
        return ($y + $h);
2531
    } //fim transporte
2532
2533
2534
    protected function descricaoProdutoHelper($origem, $campo, $formato)
2535
    {
2536
        $valor_original = $origem->getElementsByTagName($campo)->item(0);
2537
        if (! isset($valor_original)) {
2538
            return "";
2539
        }
2540
        $valor_original = $valor_original->nodeValue;
2541
        $valor          = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2542
2543
        if ($valor != "") {
2544
            return sprintf($formato, $valor);
2545
        }
2546
2547
        return "";
2548
    }
2549
2550
    /**
2551
     * descricaoProduto
2552
     * Monta a string de descrição de cada Produto
2553
     *
2554
     * @name   descricaoProduto
2555
     *
2556
     * @param DOMNode itemProd
2557
     *
2558
     * @return string descricao do produto
2559
     */
2560
    protected function descricaoProduto($itemProd)
2561
    {
2562
        $prod       = $itemProd->getElementsByTagName('prod')->item(0);
2563
        $ICMS       = $itemProd->getElementsByTagName("ICMS")->item(0);
2564
        $ICMSUFDest = $itemProd->getElementsByTagName("ICMSUFDest")->item(0);
2565
        $impostos   = '';
2566
2567
        if (! empty($ICMS)) {
2568
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vBCFCP", " BcFcp=%s");
2569
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pFCP", " pFcp=%s%%");
2570
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vFCP", " vFcp=%s");
2571
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pRedBC", " pRedBC=%s%%");
2572
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pMVAST", " IVA/MVA=%s%%");
2573
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pICMSST", " pIcmsSt=%s%%");
2574
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vBCST", " BcIcmsSt=%s");
2575
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vICMSST", " vIcmsSt=%s");
2576
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vBCFCPST", " BcFcpSt=%s");
2577
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pFCPST", " pFcpSt=%s%%");
2578
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vFCPST", " vFcpSt=%s");
2579
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vBCSTRet", " Retido na compra: BASE ICMS ST=%s");
2580
            $impostos .= $this->descricaoProdutoHelper($ICMS, "pST", " pSt=%s");
2581
            $impostos .= $this->descricaoProdutoHelper($ICMS, "vICMSSTRet", " VALOR ICMS ST=%s");
2582
        }
2583
        if (! empty($ICMSUFDest)) {
2584
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "pFCPUFDest", " pFCPUFDest=%s%%");
2585
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "pICMSUFDest", " pICMSUFDest=%s%%");
2586
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "pICMSInterPart", " pICMSInterPart=%s%%");
2587
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vFCPUFDest", " vFCPUFDest=%s");
2588
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
2589
            $impostos .= $this->descricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
2590
        }
2591
        $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue)
2592
            ? substr(
2593
                $this->anfaveaDANFE($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue),
2594
                0,
2595
                500
2596
            )
2597
            : '';
2598
        if (! empty($infAdProd)) {
2599
            $infAdProd = trim($infAdProd);
2600
            $infAdProd .= ' ';
2601
        }
2602
        $loteTxt = '';
2603
        $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...
2604
        if (! empty($prod->getElementsByTagName("rastro"))) {
2605
            $rastro = $prod->getElementsByTagName("rastro");
2606
            $i      = 0;
2607
            while ($i < $rastro->length) {
2608
                $loteTxt .= $this->getTagValue($rastro->item($i), 'nLote', ' Lote: ');
2609
                $loteTxt .= $this->getTagValue($rastro->item($i), 'qLote', ' Quant: ');
2610
                $loteTxt .= $this->getTagDate($rastro->item($i), 'dFab', ' Fab: ');
2611
                $loteTxt .= $this->getTagDate($rastro->item($i), 'dVal', ' Val: ');
2612
                $loteTxt .= $this->getTagValue($rastro->item($i), 'vPMC', ' PMC: ');
2613
                $i ++;
2614
            }
2615
            if ($loteTxt != '') {
2616
                $loteTxt .= ' ';
2617
            }
2618
        }
2619
        //NT2013.006 FCI
2620
        $nFCI   = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2621
            ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2622
        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2623
        $texto  = $prod->getElementsByTagName("xProd")->item(0)->nodeValue
2624
            . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
2625
        //decodifica os caracteres html no xml
2626
        $texto = html_entity_decode($texto);
2627
        if ($this->descProdQuebraLinha) {
2628
            $texto = str_replace(";", "\n", $texto);
2629
        }
2630
2631
        return $texto;
2632
    }
2633
2634
    /**
2635
     * itens
2636
     * Monta o campo de itens da DANFE (retrato e paisagem)
2637
     *
2638
     * @name   itens
2639
     *
2640
     * @param float $x       Posição horizontal canto esquerdo
2641
     * @param float $y       Posição vertical canto superior
2642
     * @param float $nInicio Número do item inicial
2643
     * @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...
2644
     * @param float $hmax    Altura máxima do campo de itens em mm
2645
     *
2646
     * @return float Posição vertical final
2647
     */
2648
    protected function itens($x, $y, &$nInicio, $hmax, $pag = 0, $totpag = 0, $hCabecItens = 7)
2649
    {
2650
        $oldX     = $x;
2651
        $oldY     = $y;
2652
        $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...
2653
        //#####################################################################
2654
        //DADOS DOS PRODUTOS / SERVIÇOS
2655
        $texto = "DADOS DOS PRODUTOS / SERVIÇOS";
2656
        if ($this->orientacao == 'P') {
2657
            $w = $this->wPrint;
2658
        } else {
2659
            if ($nInicio < 2) { // primeira página
2660
                $w = $this->wPrint - $this->wCanhoto;
2661
            } else { // páginas seguintes
2662
                $w = $this->wPrint;
2663
            }
2664
        }
2665
        $h     = 4;
2666
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
2667
        $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...
2668
        $y += 3;
2669
        //desenha a caixa dos dados dos itens da NF
2670
        $hmax  += 1;
2671
        $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...
2672
        $this->pdf->textBox($x, $y, $w, $hmax);
2673
        //##################################################################################
2674
        // cabecalho LOOP COM OS DADOS DOS PRODUTOS
2675
        //CÓDIGO PRODUTO
2676
        $texto = "CÓDIGO PRODUTO";
2677
        $w1    = round($w * 0.09, 0);
2678
        $h     = 4;
2679
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2680
        $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...
2681
        $this->pdf->line($x + $w1, $y, $x + $w1, $y + $hmax);
2682
        //DESCRIÇÃO DO PRODUTO / SERVIÇO
2683
        $x     += $w1;
2684
        $w2    = round($w * 0.25, 0);
2685
        $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO';
2686
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2687
        $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...
2688
        $this->pdf->line($x + $w2, $y, $x + $w2, $y + $hmax);
2689
        //NCM/SH
2690
        $x     += $w2;
2691
        $w3    = round($w * 0.06, 0);
2692
        $texto = 'NCM/SH';
2693
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2694
        $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...
2695
        $this->pdf->line($x + $w3, $y, $x + $w3, $y + $hmax);
2696
        //O/CST ou O/CSOSN
2697
        $x     += $w3;
2698
        $w4    = round($w * 0.05, 0);
2699
        $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2700
        if ($this->getTagValue($this->emit, 'CRT') == '3') {
2701
            $texto = 'O/CST';//Regime Normal
2702
        }
2703
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2704
        $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...
2705
        $this->pdf->line($x + $w4, $y, $x + $w4, $y + $hmax);
2706
        //CFOP
2707
        $x     += $w4;
2708
        $w5    = round($w * 0.04, 0);
2709
        $texto = 'CFOP';
2710
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2711
        $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...
2712
        $this->pdf->line($x + $w5, $y, $x + $w5, $y + $hmax);
2713
        //UN
2714
        $x     += $w5;
2715
        $w6    = round($w * 0.03, 0);
2716
        $texto = 'UN';
2717
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2718
        $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...
2719
        $this->pdf->line($x + $w6, $y, $x + $w6, $y + $hmax);
2720
        //QUANT
2721
        $x     += $w6;
2722
        $w7    = round($w * 0.08, 0);
2723
        $texto = 'QUANT';
2724
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2725
        $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...
2726
        $this->pdf->line($x + $w7, $y, $x + $w7, $y + $hmax);
2727
        //VALOR UNIT
2728
        $x     += $w7;
2729
        $w8    = round($w * 0.06, 0);
2730
        $texto = 'VALOR UNIT';
2731
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2732
        $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...
2733
        $this->pdf->line($x + $w8, $y, $x + $w8, $y + $hmax);
2734
        //VALOR TOTAL
2735
        $x     += $w8;
2736
        $w9    = round($w * 0.06, 0);
2737
        $texto = 'VALOR TOTAL';
2738
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2739
        $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...
2740
        $this->pdf->line($x + $w9, $y, $x + $w9, $y + $hmax);
2741
        //VALOR DESCONTO
2742
        $x     += $w9;
2743
        $w10   = round($w * 0.05, 0);
2744
        $texto = 'VALOR DESC';
2745
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2746
        $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...
2747
        $this->pdf->line($x + $w10, $y, $x + $w10, $y + $hmax);
2748
        //B.CÁLC ICMS
2749
        $x     += $w10;
2750
        $w11   = round($w * 0.06, 0);
2751
        $texto = 'B.CÁLC ICMS';
2752
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2753
        $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...
2754
        $this->pdf->line($x + $w11, $y, $x + $w11, $y + $hmax);
2755
        //VALOR ICMS
2756
        $x     += $w11;
2757
        $w12   = round($w * 0.06, 0);
2758
        $texto = 'VALOR ICMS';
2759
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2760
        $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...
2761
        $this->pdf->line($x + $w12, $y, $x + $w12, $y + $hmax);
2762
        //VALOR IPI
2763
        $x     += $w12;
2764
        $w13   = round($w * 0.05, 0);
2765
        $texto = 'VALOR IPI';
2766
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2767
        $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...
2768
        $this->pdf->line($x + $w13, $y, $x + $w13, $y + $hmax);
2769
        //ALÍQ. ICMS
2770
        $x     += $w13;
2771
        $w14   = round($w * 0.04, 0);
2772
        $texto = 'ALÍQ. ICMS';
2773
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
2774
        $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...
2775
        $this->pdf->line($x + $w14, $y, $x + $w14, $y + $hmax);
2776
        //ALÍQ. IPI
2777
        $x     += $w14;
2778
        $w15   = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13 + $w14);
2779
        $texto = 'ALÍQ. IPI';
2780
        $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...
2781
        $this->pdf->line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1);
2782
        $y += 5;
2783
        //##################################################################################
2784
        // LOOP COM OS DADOS DOS PRODUTOS
2785
        $i      = 0;
2786
        $hUsado = $hCabecItens;
2787
        $aFont  = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
2788
2789
        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...
2790
            if ($i >= $nInicio) {
2791
                $thisItem = $this->det->item($i);
2792
                //carrega as tags do item
2793
                $prod         = $thisItem->getElementsByTagName("prod")->item(0);
2794
                $imposto      = $this->det->item($i)->getElementsByTagName("imposto")->item(0);
2795
                $ICMS         = $imposto->getElementsByTagName("ICMS")->item(0);
2796
                $IPI          = $imposto->getElementsByTagName("IPI")->item(0);
2797
                $textoProduto = $this->descricaoProduto($thisItem);
2798
2799
                // Posição y dos dados das unidades tributaveis.
2800
                $yTrib = $this->pdf->fontSize + .5;
2801
                if (! $this->mostrarUnidadeTributavel) {
2802
                    $yTrib = 0;
2803
                }
2804
                $h      = $this->calculeHeight($thisItem);
2805
                $hUsado += $h;
2806
2807
                $yTrib += $y;
2808
                $diffH = $hmax - $hUsado;
2809
2810
                if ($pag != $totpag) {
2811
                    if (1 > $diffH && $i < $totItens) {
2812
                        //ultrapassa a capacidade para uma única página
2813
                        //o restante dos dados serão usados nas proximas paginas
2814
                        $nInicio = $i;
2815
                        break;
2816
                    }
2817
                }
2818
                $y_linha = $y + $h;
2819
                // linha entre itens
2820
                $this->pdf->dashedHLine($oldX, $y_linha, $w, 0.1, 120);
2821
                //corrige o x
2822
                $x = $oldX;
2823
                //codigo do produto
2824
                $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...
2825
                $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue;
2826
                $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...
2827
                $x += $w1;
2828
                //DESCRIÇÃO
2829
                if ($this->orientacao == 'P') {
2830
                    $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...
2831
                } else {
2832
                    $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...
2833
                }
2834
                $x += $w2;
2835
                //NCM
2836
                $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2837
                    $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';
2838
                $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...
2839
                $x += $w3;
2840
                //CST
2841
                if (isset($ICMS)) {
2842
                    $origem = $this->getTagValue($ICMS, "orig");
2843
                    $cst    = $this->getTagValue($ICMS, "CST");
2844
                    $csosn  = $this->getTagValue($ICMS, "CSOSN");
2845
                    $texto  = $origem . $cst . $csosn;
2846
                    $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...
2847
                }
2848
                //CFOP
2849
                $x     += $w4;
2850
                $texto = $prod->getElementsByTagName("CFOP")->item(0)->nodeValue;
2851
                $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...
2852
                //Unidade
2853
                $x     += $w5;
2854
                $texto = $prod->getElementsByTagName("uCom")->item(0)->nodeValue;
2855
                $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...
2856
                //Unidade de medida tributável
2857
                if ($this->mostrarUnidadeTributavel) {
2858
                    $uTrib = $prod->getElementsByTagName("uTrib")->item(0);
2859
                    if (! empty($uTrib)) {
2860
                        $texto = $uTrib->nodeValue;
2861
                        $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...
2862
                    }
2863
                }
2864
                $x += $w6;
2865
                if ($this->orientacao == 'P') {
2866
                    $alinhamento = 'R';
2867
                } else {
2868
                    $alinhamento = 'R';
2869
                }
2870
                // QTDADE
2871
                $qCom  = $prod->getElementsByTagName("qCom")->item(0);
2872
                $texto = number_format($qCom->nodeValue, $this->qComCasasDec, ",", ".");
2873
                $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...
2874
                // QTDADE Tributável
2875
                if ($this->mostrarUnidadeTributavel) {
2876
                    $qTrib = $prod->getElementsByTagName("qTrib")->item(0);
2877
                    if (! empty($qTrib)) {
2878
                        $texto = number_format($qTrib->nodeValue, $this->qComCasasDec, ",", ".");
2879
                        $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...
2880
                    }
2881
                }
2882
                $x += $w7;
2883
                // Valor Unitário
2884
                $vUnCom = $prod->getElementsByTagName("vUnCom")->item(0);
2885
                $texto  = number_format($vUnCom->nodeValue, $this->vUnComCasasDec, ",", ".");
2886
                $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...
2887
                // Valor Unitário Tributável
2888
                if ($this->mostrarUnidadeTributavel) {
2889
                    $vUnTrib = $prod->getElementsByTagName("vUnTrib")->item(0);
2890
                    if (! empty($vUnTrib)) {
2891
                        $texto = number_format($vUnTrib->nodeValue, $this->vUnComCasasDec, ",", ".");
2892
                        $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...
2893
                    }
2894
                }
2895
                $x += $w8;
2896
                // Valor do Produto
2897
                $texto = "";
2898
                if (is_numeric($prod->getElementsByTagName("vProd")->item(0)->nodeValue)) {
2899
                    $texto = number_format($prod->getElementsByTagName("vProd")->item(0)->nodeValue, 2, ",", ".");
2900
                }
2901
                $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...
2902
                $x += $w9;
2903
                //Valor do Desconto
2904
                $vdesc = ! empty($prod->getElementsByTagName("vDesc")->item(0)->nodeValue)
2905
                    ? $prod->getElementsByTagName("vDesc")->item(0)->nodeValue : 0;
2906
2907
                $texto = number_format($vdesc, 2, ",", ".");
2908
                $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...
2909
                //Valor da Base de calculo
2910
                $x += $w10;
2911
                if (isset($ICMS)) {
2912
                    $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue)
2913
                        ? number_format(
2914
                            $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue,
2915
                            2,
2916
                            ",",
2917
                            "."
2918
                        )
2919
                        : '0,00';
2920
                    $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...
2921
                }
2922
                //Valor do ICMS
2923
                $x += $w11;
2924
                if (isset($ICMS)) {
2925
                    $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue)
2926
                        ? number_format(
2927
                            $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue,
2928
                            2,
2929
                            ",",
2930
                            "."
2931
                        )
2932
                        : '0,00';
2933
                    $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...
2934
                }
2935
                //Valor do IPI
2936
                $x += $w12;
2937
                if (isset($IPI)) {
2938
                    $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue)
2939
                        ? number_format(
2940
                            $IPI->getElementsByTagName("vIPI")->item(0)->nodeValue,
2941
                            2,
2942
                            ",",
2943
                            "."
2944
                        )
2945
                        : '';
2946
                } else {
2947
                    $texto = '';
2948
                }
2949
                $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...
2950
                // %ICMS
2951
                $x += $w13;
2952
                if (isset($ICMS)) {
2953
                    $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue)
2954
                        ? number_format(
2955
                            $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue,
2956
                            2,
2957
                            ",",
2958
                            "."
2959
                        )
2960
                        : '0,00';
2961
                    $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...
2962
                }
2963
                //%IPI
2964
                $x += $w14;
2965
                if (isset($IPI)) {
2966
                    $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue)
2967
                        ? number_format(
2968
                            $IPI->getElementsByTagName("pIPI")->item(0)->nodeValue,
2969
                            2,
2970
                            ",",
2971
                            "."
2972
                        )
2973
                        : '';
2974
                } else {
2975
                    $texto = '';
2976
                }
2977
                $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...
2978
2979
2980
                // Dados do Veiculo Somente para veiculo 0 Km
2981
                $veicProd = $prod->getElementsByTagName("veicProd")->item(0);
2982
                // Tag somente é gerada para veiculo 0k, e só é permitido um veiculo por NF-e por conta do detran
2983
                // Verifica se a Tag existe
2984
                if (! empty($veicProd)) {
2985
                    $this->dadosItenVeiculoDANFE($oldX, $y, $nInicio, $h, $prod);
2986
                }
2987
2988
2989
                $y += $h;
2990
                $i ++;
2991
                //incrementa o controle dos itens processados.
2992
                $this->qtdeItensProc ++;
2993
            } else {
2994
                $i ++;
2995
            }
2996
        }
2997
2998
        return $oldY + $hmax;
2999
    }
3000
3001
3002
    /**
3003
     * dadosItenVeiculoDANFE
3004
     * Coloca os dados do veiculo abaixo do item da NFe. (retrato e paisagem)
3005
     *
3006
     * @param float  $x    Posição horizontal
3007
     *                     canto esquerdo
3008
     * @param float  $y    Posição vertical
3009
     *                     canto superior
3010
     * @param        $nInicio
3011
     * @param float  $h    altura do campo
3012
     * @param object $prod Contendo todos os dados do item
3013
     */
3014
3015
    protected function dadosItenVeiculoDANFE($x, $y, &$nInicio, $h, $prod)
3016
    {
3017
        $oldX = $x;
3018
        $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...
3019
3020
        if ($this->orientacao == 'P') {
3021
            $w = $this->wPrint;
3022
        } else {
3023
            if ($nInicio < 2) { // primeira página
3024
                $w = $this->wPrint - $this->wCanhoto;
3025
            } else { // páginas seguintes
3026
                $w = $this->wPrint;
3027
            }
3028
        }
3029
3030
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
3031
3032
        $w1 = round($w * 0.09, 0);
3033
3034
        // Tabela Renavam Combustivel
3035
        $renavamCombustivel = [
3036
            1  => 'ALCOOL',
3037
            2  => 'GASOLINA',
3038
            3  => 'DIESEL',
3039
            4  => 'GASOGENIO',
3040
            5  => 'GAS METANO',
3041
            6  => 'ELETRICO/FONTE INTERNA',
3042
            7  => 'ELETRICO/FONTE EXTERNA',
3043
            8  => 'GASOL/GAS NATURAL COMBUSTIVEL',
3044
            9  => 'ALCOOL/GAS NATURAL COMBUSTIVEL',
3045
            10 => 'DIESEL/GAS NATURAL COMBUSTIVEL',
3046
            11 => 'VIDE/CAMPO/OBSERVACAO',
3047
            12 => 'ALCOOL/GAS NATURAL VEICULAR',
3048
            13 => 'GASOLINA/GAS NATURAL VEICULAR',
3049
            14 => 'DIESEL/GAS NATURAL VEICULAR',
3050
            15 => 'GAS NATURAL VEICULAR',
3051
            16 => 'ALCOOL/GASOLINA',
3052
            17 => 'GASOLINA/ALCOOL/GAS NATURAL',
3053
            18 => 'GASOLINA/ELETRICO'
3054
        ];
3055
3056
        $renavamEspecie = [
3057
            1 => 'PASSAGEIRO',
3058
            2 => 'CARGA',
3059
            3 => 'MISTO',
3060
            4 => 'CORRIDA',
3061
            5 => 'TRACAO',
3062
            6 => 'ESPECIAL',
3063
            7 => 'COLECAO'
3064
        ];
3065
3066
        $renavamTiposVeiculos = [
3067
            1  => 'BICICLETA',
3068
            2  => 'CICLOMOTOR',
3069
            3  => 'MOTONETA',
3070
            4  => 'MOTOCICLETA',
3071
            5  => 'TRICICLO',
3072
            6  => 'AUTOMOVEL',
3073
            7  => 'MICROONIBUS',
3074
            8  => 'ONIBUS',
3075
            9  => 'BONDE',
3076
            10 => 'REBOQUE',
3077
            11 => 'SEMI-REBOQUE',
3078
            12 => 'CHARRETE',
3079
            13 => 'CAMIONETA',
3080
            14 => 'CAMINHAO',
3081
            15 => 'CARROCA',
3082
            16 => 'CARRO DE MAO',
3083
            17 => 'CAMINHAO TRATOR',
3084
            18 => 'TRATOR DE RODAS',
3085
            19 => 'TRATOR DE ESTEIRAS',
3086
            20 => 'TRATOR MISTO',
3087
            21 => 'QUADRICICLO',
3088
            22 => 'CHASSI/PLATAFORMA',
3089
            23 => 'CAMINHONETE',
3090
            24 => 'SIDE-CAR',
3091
            25 => 'UTILITARIO',
3092
            26 => 'MOTOR-CASA'
3093
        ];
3094
3095
        $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...
3096
            'F' => 'FOSCA',
3097
            'S' => 'SÓLIDA',
3098
            'P' => 'PEROLIZADA',
3099
            'M' => 'METALICA',
3100
        ];
3101
3102
        $veicProd = $prod->getElementsByTagName("veicProd")->item(0);
3103
3104
        $veiculoChassi     = $veicProd->getElementsByTagName("chassi")->item(0)->nodeValue;
3105
        $veiculoCor        = $veicProd->getElementsByTagName("xCor")->item(0)->nodeValue;
3106
        $veiculoCilindrada = $veicProd->getElementsByTagName("cilin")->item(0)->nodeValue;
3107
        $veiculoCmkg       = $veicProd->getElementsByTagName("CMT")->item(0)->nodeValue;
3108
        $veiculoTipo       = $veicProd->getElementsByTagName("tpVeic")->item(0)->nodeValue;
3109
3110
        $veiculoMotor       = $veicProd->getElementsByTagName("nMotor")->item(0)->nodeValue;
3111
        $veiculoRenavam     = $veicProd->getElementsByTagName("cMod")->item(0)->nodeValue;
3112
        $veiculoHp          = $veicProd->getElementsByTagName("pot")->item(0)->nodeValue;
3113
        $veiculoPlaca       = ''; //$veiculo->getElementsByTagName("CMT")->item(0)->nodeValue;
3114
        $veiculoTipoPintura = $veicProd->getElementsByTagName("tpPint")->item(0)->nodeValue;
3115
        $veiculoMarcaModelo = $prod->getElementsByTagName("xProd")->item(0)->nodeValue;
3116
        $veiculoEspecie     = $veicProd->getElementsByTagName("espVeic")->item(0)->nodeValue;
3117
        $veiculoCombustivel = $veicProd->getElementsByTagName("tpComb")->item(0)->nodeValue;
3118
        $veiculoSerial      = $veicProd->getElementsByTagName("nSerie")->item(0)->nodeValue;
3119
        $veiculoFabricacao  = $veicProd->getElementsByTagName("anoFab")->item(0)->nodeValue;
3120
        $veiculoModelo      = $veicProd->getElementsByTagName("anoMod")->item(0)->nodeValue;
3121
        $veiculoDistancia   = $veicProd->getElementsByTagName("dist")->item(0)->nodeValue;
3122
3123
        $x = $oldX;
3124
3125
        $yVeic = $y + $h;
3126
        $texto = 'Chassi: ............: ' . $veiculoChassi;
3127
        $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...
3128
        $yVeic += $h;
3129
        $texto = 'Cor...................: ' . $veiculoCor;
3130
        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3131
        $yVeic += $h;
3132
        $texto = 'Cilindrada........: ' . $veiculoCilindrada;
3133
        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3134
        $yVeic += $h;
3135
        $texto = 'Cmkg...............: ' . $veiculoCmkg;
3136
        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3137
        $yVeic += $h;
3138
        $texto = 'Tipo.................: ' . ($renavamTiposVeiculos[intval($veiculoTipo)] ?? $veiculoTipo);
3139
        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3140
        $yVeic = $y + $h;
3141
        $xVeic = $x + 65;
3142
        $texto = 'Nº Motor: .........: ' . $veiculoMotor;
3143
        $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...
3144
        $yVeic += $h;
3145
        $texto = 'Renavam...........: ' . $veiculoRenavam;
3146
        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3147
        $yVeic += $h;
3148
        $texto = 'HP.....................: ' . $veiculoHp;
3149
        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3150
        $yVeic += $h;
3151
        $texto = 'Placa.................: ' . $veiculoPlaca;
3152
        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3153
        $yVeic += $h;
3154
        $texto = 'Tipo Pintura......: ' . ($renavamEspecie[intval($veiculoTipoPintura)] ?? $veiculoTipoPintura);
3155
        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3156
        $yVeic = $y + $h;
3157
        $xVeic = $xVeic + 55;
3158
        $texto = 'Marca / Modelo.....: ' . $veiculoMarcaModelo;
3159
        $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...
3160
        $yVeic += $h;
3161
        $texto = 'Especie..................: ' . ($renavamEspecie[intval($veiculoEspecie)] ?? $veiculoEspecie);
3162
        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3163
        $yVeic += $h;
3164
        $texto = 'Combustivel..........: ' . ($renavamCombustivel[intval($veiculoCombustivel)] ?? $veiculoCombustivel);
3165
        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3166
        $yVeic += $h;
3167
        $texto = 'Serial.....................: ' . $veiculoSerial;
3168
        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3169
        $yVeic += $h;
3170
        $texto = 'Ano Fab/Mod........: ' . $veiculoFabricacao . '/' . $veiculoModelo;
3171
        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3172
        $yVeic += $h;
3173
        $texto = 'Distancia Entre Eixos(mm)..: ' . $veiculoDistancia;
3174
        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
3175
    }
3176
3177
    /**
3178
     * issqn
3179
     * Monta o campo de serviços do DANFE
3180
     *
3181
     * @name   issqn (retrato e paisagem)
3182
     *
3183
     * @param float $x Posição horizontal canto esquerdo
3184
     * @param float $y Posição vertical canto superior
3185
     *
3186
     * @return float Posição vertical final
3187
     */
3188
    protected function issqn($x, $y)
3189
    {
3190
        $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...
3191
        //#####################################################################
3192
        //CÁLCULO DO ISSQN
3193
        $texto = "CÁLCULO DO ISSQN";
3194
        $w     = $this->wPrint;
3195
        $h     = 7;
3196
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
3197
        $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...
3198
        //INSCRIÇÃO MUNICIPAL
3199
        $y     += 3;
3200
        $w     = round($this->wPrint * 0.23, 0);
3201
        $texto = 'INSCRIÇÃO MUNICIPAL';
3202
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3203
        $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...
3204
        //inscrição municipal
3205
        $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
3206
            $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : '';
3207
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
3208
        $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...
3209
        //VALOR TOTAL DOS SERVIÇOS
3210
        $x     += $w;
3211
        $texto = 'VALOR TOTAL DOS SERVIÇOS';
3212
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3213
        $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...
3214
        if (isset($this->ISSQNtot)) {
3215
            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
3216
                $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : '';
3217
            $texto = number_format($texto, 2, ",", ".");
3218
        } else {
3219
            $texto = '';
3220
        }
3221
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
3222
        $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...
3223
        //BASE DE CÁLCULO DO ISSQN
3224
        $x     += $w;
3225
        $texto = 'BASE DE CÁLCULO DO ISSQN';
3226
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3227
        $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...
3228
        if (isset($this->ISSQNtot)) {
3229
            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
3230
                $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : '';
3231
            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
3232
        } else {
3233
            $texto = '';
3234
        }
3235
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
3236
        $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...
3237
        //VALOR TOTAL DO ISSQN
3238
        $x += $w;
3239
        if ($this->orientacao == 'P') {
3240
            $w = $this->wPrint - (3 * $w);
3241
        } else {
3242
            $w = $this->wPrint - (3 * $w) - $this->wCanhoto;
3243
        }
3244
        $texto = 'VALOR TOTAL DO ISSQN';
3245
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3246
        $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...
3247
        if (isset($this->ISSQNtot)) {
3248
            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
3249
                $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : '';
3250
            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
3251
        } else {
3252
            $texto = '';
3253
        }
3254
        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
3255
        $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...
3256
3257
        return ($y + $h + 1);
3258
    }
3259
3260
    /**
3261
     *dadosAdicionais
3262
     * Coloca o grupo de dados adicionais da NFe. (retrato e paisagem)
3263
     *
3264
     * @name   dadosAdicionais
3265
     *
3266
     * @param float $x Posição horizontal canto esquerdo
3267
     * @param float $y Posição vertical canto superior
3268
     * @param float $h altura do campo
3269
     *
3270
     * @return float Posição vertical final (eixo Y)
3271
     */
3272
    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...
3273
    {
3274
        $y = $this->maxH - (7 + $h);
3275
        //$y = $this->maxH - 20;
3276
        //##################################################################################
3277
        //DADOS ADICIONAIS
3278
        $texto = "DADOS ADICIONAIS";
3279
        if ($this->orientacao == 'P') {
3280
            $w = $this->wPrint;
3281
        } else {
3282
            $w = $this->wPrint - $this->wCanhoto;
3283
        }
3284
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => 'B'];
3285
        $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...
3286
3287
        //INFORMAÇÕES COMPLEMENTARES
3288
        $texto = "INFORMAÇÕES COMPLEMENTARES";
3289
        $y     += 3;
3290
        $w     = $this->wAdic;
3291
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'B'];
3292
        $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...
3293
        //o texto com os dados adicionais foi obtido na função montaDANFE
3294
        //e carregado em uma propriedade privada da classe
3295
        //$this->wAdic com a largura do campo
3296
        //$this->textoAdic com o texto completo do campo
3297
        //echo str_replace("\n", "<br>",$this->textoAdic);
3298
        //die;
3299
        $y     += 1;
3300
        $aFont = ['font' => $this->fontePadrao, 'size' => $this->textadicfontsize * $this->pdf->k, 'style' => ''];
3301
        //$aFont = ['font'=>$this->fontePadrao, 'size'=> 5, 'style'=>''];
3302
        $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...
3303
        //RESERVADO AO FISCO
3304
        $texto = "RESERVADO AO FISCO";
3305
        if (isset($this->nfeProc) && $this->nfeProc->getElementsByTagName("xMsg")->length) {
3306
            $texto = $texto . ' ' . $this->nfeProc->getElementsByTagName("xMsg")->item(0)->nodeValue;
3307
        }
3308
        $x += $w;
3309
        $y -= 1;
3310
        if ($this->orientacao == 'P') {
3311
            $w = $this->wPrint - $w;
3312
        } else {
3313
            $w = $this->wPrint - $w - $this->wCanhoto;
3314
        }
3315
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'B'];
3316
        $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...
3317
        //inserir texto informando caso de contingência
3318
        // 1 - Normal - emissão normal;
3319
        // 2 - Contingência FS - emissão em contingência com impressão do DANFE em Formulário de Segurança;
3320
        // 3 - Contingência SCAN - emissão em contingência no Sistema de Contingência do Ambiente Nacional;
3321
        // 4 - Contingência DPEC - emissão em contingência com envio da Declaração
3322
        //     Prévia de Emissão em Contingência;
3323
        // 5 - Contingência FS-DA - emissão em contingência com impressão do DANFE em Formulário de
3324
        //     Segurança para Impressão de Documento Auxiliar de Documento Fiscal Eletrônico (FS-DA);
3325
        // 6 - Contingência SVC-AN
3326
        // 7 - Contingência SVC-RS
3327
        $xJust  = $this->getTagValue($this->ide, 'xJust', 'Justificativa: ');
3328
        $dhCont = $this->getTagValue($this->ide, 'dhCont', ' Entrada em contingência : ');
3329
        $texto  = '';
3330
        switch ($this->tpEmis) {
3331
            case 2:
3332
                $texto = 'CONTINGÊNCIA FS' . $dhCont . $xJust;
3333
                break;
3334
            case 3:
3335
                $texto = 'CONTINGÊNCIA SCAN' . $dhCont . $xJust;
3336
                break;
3337
            case 4:
3338
                $texto = 'CONTINGÊNCIA DPEC' . $dhCont . $xJust;
3339
                break;
3340
            case 5:
3341
                $texto = 'CONTINGÊNCIA FSDA' . $dhCont . $xJust;
3342
                break;
3343
            case 6:
3344
                $texto = 'CONTINGÊNCIA SVC-AN' . $dhCont . $xJust;
3345
                break;
3346
            case 7:
3347
                $texto = 'CONTINGÊNCIA SVC-RS' . $dhCont . $xJust;
3348
                break;
3349
        }
3350
        $y     += 2;
3351
        $aFont = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
3352
        $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...
3353
3354
        return $y + $h;
3355
    }
3356
3357
    /**
3358
     * rodape
3359
     * Monta o rodapé no final da DANFE com a data/hora de impressão e informações
3360
     * sobre a API NfePHP
3361
     *
3362
     * @param float $x Posição horizontal canto esquerdo
3363
     *
3364
     * @return void
3365
     */
3366
    protected function rodape($x)
3367
    {
3368
        $y = $this->maxH - 4;
3369
        if ($this->orientacao == 'P') {
3370
            $w = $this->wPrint;
3371
        } else {
3372
            $w = $this->wPrint - $this->wCanhoto;
3373
            $x = $this->wCanhoto;
3374
        }
3375
        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I'];
3376
        $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s')
3377
            . '  ' . $this->creditos;
3378
        $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false);
3379
        $texto = $this->powered ? "Powered by NFePHP®" : '';
3380
        $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'R', false, '');
3381
    }
3382
3383
    /**
3384
     * Monta o canhoto da DANFE (retrato e paisagem)
3385
     *
3386
     * @name   canhotoDANFE
3387
     *
3388
     * @param number $x Posição horizontal canto esquerdo
3389
     * @param number $y Posição vertical canto superior
3390
     *
3391
     * @return number Posição vertical final
3392
     *
3393
     * TODO 21/07/14 fmertins: quando orientação L-paisagem, o canhoto está sendo gerado incorretamente
3394
     */
3395
    protected function canhoto($x, $y)
3396
    {
3397
        $oldX = $x;
3398
        $oldY = $y;
3399
        //#################################################################################
3400
        //canhoto
3401
        //identificação do tipo de nf entrada ou saida
3402
        $tpNF = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
3403
        if ($tpNF == '0') {
3404
            //NFe de Entrada
3405
            $emitente     = '';
3406
            $emitente     .= $this->dest->getElementsByTagName("xNome")->item(0)->nodeValue . " - ";
3407
            $emitente     .= $this->enderDest->getElementsByTagName("xLgr")->item(0)->nodeValue . ", ";
3408
            $emitente     .= $this->enderDest->getElementsByTagName("nro")->item(0)->nodeValue . " - ";
3409
            $emitente     .= $this->getTagValue($this->enderDest, "xCpl", " - ", " ");
3410
            $emitente     .= $this->enderDest->getElementsByTagName("xBairro")->item(0)->nodeValue . " ";
3411
            $emitente     .= $this->enderDest->getElementsByTagName("xMun")->item(0)->nodeValue . "-";
3412
            $emitente     .= $this->enderDest->getElementsByTagName("UF")->item(0)->nodeValue . "";
3413
            $destinatario = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue . " ";
3414
        } else {
3415
            //NFe de Saída
3416
            $emitente     = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue . " ";
3417
            $destinatario = '';
3418
            $destinatario .= $this->dest->getElementsByTagName("xNome")->item(0)->nodeValue . " - ";
3419
            $destinatario .= $this->enderDest->getElementsByTagName("xLgr")->item(0)->nodeValue . ", ";
3420
            $destinatario .= $this->enderDest->getElementsByTagName("nro")->item(0)->nodeValue . " ";
3421
            $destinatario .= $this->getTagValue($this->enderDest, "xCpl", " - ", " ");
3422
            $destinatario .= $this->enderDest->getElementsByTagName("xBairro")->item(0)->nodeValue . " ";
3423
            $destinatario .= $this->enderDest->getElementsByTagName("xMun")->item(0)->nodeValue . "-";
3424
            $destinatario .= $this->enderDest->getElementsByTagName("UF")->item(0)->nodeValue . " ";
3425
        }
3426
        //identificação do sistema emissor
3427
        //linha separadora do canhoto
3428
        if ($this->orientacao == 'P') {
3429
            $w = round($this->wPrint * 0.81, 0);
3430
        } else {
3431
            //linha separadora do canhoto - 238
3432
            //posicao altura
3433
            $y = $this->wPrint - 85;
3434
            //altura
3435
            $w = $this->wPrint - 85 - 24;
3436
        }
3437
        $h = 10;
3438
        //desenha caixa
3439
        $texto      = '';
3440
        $aFont      = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
3441
        $aFontSmall = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3442
        if ($this->orientacao == 'P') {
3443
            $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...
3444
        } else {
3445
            $this->pdf->textBox90($x, $y, $w, $h, $texto, $aFont, 'C', 'L', 1, '', false);
3446
        }
3447
        $numNF = str_pad($this->ide->getElementsByTagName('nNF')->item(0)->nodeValue, 9, "0", STR_PAD_LEFT);
3448
        $serie = str_pad($this->ide->getElementsByTagName('serie')->item(0)->nodeValue, 3, "0", STR_PAD_LEFT);
3449
        $texto = "RECEBEMOS DE ";
3450
        $texto .= $emitente;
3451
        $texto .= " OS PRODUTOS E/OU SERVIÇOS CONSTANTES DA NOTA FISCAL ELETRÔNICA INDICADA ";
3452
        if ($this->orientacao == 'P') {
3453
            $texto .= "ABAIXO";
3454
        } else {
3455
            $texto .= "AO LADO";
3456
        }
3457
        $texto .= ". EMISSÃO: ";
3458
        $dEmi  = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3459
            $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3460
        if ($dEmi == '') {
3461
            $dEmi  = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3462
                $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3463
            $aDemi = explode('T', $dEmi);
3464
            $dEmi  = $aDemi[0];
3465
        }
3466
        $texto .= $this->ymdTodmy($dEmi) . " ";
3467
        $texto .= "VALOR TOTAL: R$ ";
3468
        $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " ";
3469
        $texto .= "DESTINATÁRIO: ";
3470
        $texto .= $destinatario;
3471
        if ($this->orientacao == 'P') {
3472
            $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...
3473
            $x1    = $x + $w;
3474
            $w1    = $this->wPrint - $w;
3475
            $texto = "NF-e";
3476
            $aFont = ['font' => $this->fontePadrao, 'size' => 14, 'style' => 'B'];
3477
            $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...
3478
            $texto = "Nº. " . $this->formatField($numNF, "###.###.###") . " \n";
3479
            $texto .= "Série $serie";
3480
            $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
3481
            $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...
3482
            //DATA DE RECEBIMENTO
3483
            $texto = "DATA DE RECEBIMENTO";
3484
            $y     += $h;
3485
            $w2    = round($this->wPrint * 0.17, 0); //35;
3486
            $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3487
            $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...
3488
            //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3489
            $x     += $w2;
3490
            $w3    = $w - $w2;
3491
            $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3492
            $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...
3493
            $x = $oldX;
3494
            $y += 9;
3495
            $this->pdf->dashedHLine($x, $y, $this->wPrint, 0.1, 80);
3496
            $y += 2;
3497
3498
            return $y;
3499
        } else {
3500
            $x --;
3501
            $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...
3502
            //NUMERO DA NOTA FISCAL LOGO NFE
3503
            $w1    = 18;
3504
            $x1    = $oldX;
3505
            $y     = $oldY;
3506
            $texto = "NF-e";
3507
            $aFont = ['font' => $this->fontePadrao, 'size' => 14, 'style' => 'B'];
3508
            $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...
3509
            $texto = "Nº.\n" . $this->formatField($numNF, "###.###.###") . " \n";
3510
            $texto .= "Série $serie";
3511
            $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
3512
            $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...
3513
            //DATA DO RECEBIMENTO
3514
            $texto = "DATA DO RECEBIMENTO";
3515
            $y     = $this->wPrint - 85;
3516
            $x     = 12;
3517
            $w2    = round($this->wPrint * 0.17, 0); //35;
3518
            $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => ''];
3519
            $this->pdf->textBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3520
            //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3521
            $y     -= $w2;
3522
            $w3    = $w - $w2;
3523
            $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3524
            $aFont = ['font' => $this->fontePadrao, 'size' => 5.7, 'style' => ''];
3525
            $x     = $this->pdf->textBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3526
            $this->pdf->dashedVLine(22, $oldY, 0.1, $this->wPrint, 69);
3527
3528
            return $x;
3529
        }
3530
    }
3531
3532
    /**
3533
     * geraInformacoesDaTagCompra
3534
     * Devolve uma string contendo informação sobre as tag <compra><xNEmp>, <xPed> e <xCont> ou string vazia.
3535
     * Aviso: Esta função não leva em consideração dados na tag xPed do item.
3536
     *
3537
     * @name   pGeraInformacoesDaTagCompra
3538
     * @return string com as informacoes dos pedidos.
3539
     */
3540
    protected function geraInformacoesDaTagCompra()
3541
    {
3542
        if (! $this->gerarInformacoesAutomaticas) {
3543
            return '';
3544
        }
3545
        $saida = "";
3546
        if (isset($this->compra)) {
3547
            if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3548
                $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue;
3549
            }
3550
            if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3551
                $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue;
3552
            }
3553
            if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3554
                $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue;
3555
            }
3556
        }
3557
3558
        return $saida;
3559
    }
3560
3561
    /**
3562
     * geraChaveAdicionalDeContingencia
3563
     *
3564
     * @name   geraChaveAdicionalDeContingencia
3565
     * @return string chave
3566
     */
3567
    protected function geraChaveAdicionalDeContingencia()
3568
    {
3569
        //cUF tpEmis CNPJ vNF ICMSp ICMSs DD  DV
3570
        // Quantidade de caracteres  02   01      14  14    01    01  02 01
3571
        $forma = "%02d%d%s%014d%01d%01d%02d";
3572
        $cUF   = $this->ide->getElementsByTagName('cUF')->item(0)->nodeValue;
3573
        $CNPJ  = "00000000000000" . $this->emit->getElementsByTagName('CNPJ')->item(0)->nodeValue;
3574
        $CNPJ  = substr($CNPJ, - 14);
3575
        $vNF   = $this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue * 100;
3576
        $vICMS = $this->ICMSTot->getElementsByTagName("vICMS")->item(0)->nodeValue;
3577
        if ($vICMS > 0) {
3578
            $vICMS = 1;
3579
        }
3580
        $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3581
        if ($icmss > 0) {
3582
            $icmss = 1;
3583
        }
3584
        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3585
            $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3586
        if ($dEmi == '') {
3587
            $dEmi  = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3588
                $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3589
            $aDemi = explode('T', $dEmi);
3590
            $dEmi  = $aDemi[0];
3591
        }
3592
        $dd    = $dEmi;
3593
        $rpos  = strrpos($dd, '-');
3594
        $dd    = substr($dd, $rpos + 1);
3595
        $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd);
3596
        $chave = $chave . $this->modulo11($chave);
3597
3598
        return $chave;
3599
    }
3600
3601
    /**
3602
     *  geraInformacoesDasNotasReferenciadas
3603
     * Devolve uma string contendo informação sobre as notas referenciadas. Suporta N notas, eletrônicas ou não
3604
     * Exemplo: NFe Ref.: série: 01 número: 01 emit: 11.111.111/0001-01
3605
     * em 10/2010 [0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000]
3606
     *
3607
     * @return string Informacoes a serem adicionadas no rodapé sobre notas referenciadas.
3608
     */
3609
    protected function geraInformacoesDasNotasReferenciadas()
3610
    {
3611
        if (! $this->gerarInformacoesAutomaticas) {
3612
            return '';
3613
        }
3614
        $formaNfeRef = "\r\nNFe Ref.: série:%d número:%d emit:%s em %s [%s]";
3615
        $formaCTeRef = "\r\nCTe Ref.: série:%d número:%d emit:%s em %s [%s]";
3616
        $formaNfRef  = "\r\nNF  Ref.: série:%d numero:%d emit:%s em %s modelo: %d";
3617
        $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d";
3618
        $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s";
3619
        $saida       = '';
3620
        $nfRefs      = $this->ide->getElementsByTagName('NFref');
3621
        if (0 === $nfRefs->length) {
3622
            return $saida;
3623
        }
3624
        if ($nfRefs->length > 2) {
3625
            return 'Existem mais de 2 NF/NFe/ECF/NFP/CTe referenciadas, não serão exibidas na DANFE.';
3626
        }
3627
        foreach ($nfRefs as $nfRef) {
3628
            if (empty($nfRef)) {
3629
                continue;
3630
            }
3631
            $refNFe = $nfRef->getElementsByTagName('refNFe');
3632
            foreach ($refNFe as $chave_acessoRef) {
3633
                $chave_acesso  = $chave_acessoRef->nodeValue;
3634
                $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3635
                $data          = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3636
                $cnpj          = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3637
                $serie         = substr($chave_acesso, 22, 3);
3638
                $numero        = substr($chave_acesso, 25, 9);
3639
                $saida         .= sprintf($formaNfeRef, $serie, $numero, $cnpj, $data, $chave_acessoF);
3640
            }
3641
            $refNF = $nfRef->getElementsByTagName('refNF');
3642
            foreach ($refNF as $umaRefNFe) {
3643
                $data   = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3644
                $cnpj   = $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue;
3645
                $mod    = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3646
                $serie  = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
3647
                $numero = $umaRefNFe->getElementsByTagName('nNF')->item(0)->nodeValue;
3648
                $data   = substr($data, 2, 2) . "/20" . substr($data, 0, 2);
3649
                $cnpj   = $this->formatField($cnpj, "##.###.###/####-##");
3650
                $saida  .= sprintf($formaNfRef, $serie, $numero, $cnpj, $data, $mod);
3651
            }
3652
            $refCTe = $nfRef->getElementsByTagName('refCTe');
3653
            foreach ($refCTe as $chave_acessoRef) {
3654
                $chave_acesso  = $chave_acessoRef->nodeValue;
3655
                $chave_acessoF = $this->formatField($chave_acesso, $this->formatoChave);
3656
                $data          = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3657
                $cnpj          = $this->formatField(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3658
                $serie         = substr($chave_acesso, 22, 3);
3659
                $numero        = substr($chave_acesso, 25, 9);
3660
                $saida         .= sprintf($formaCTeRef, $serie, $numero, $cnpj, $data, $chave_acessoF);
3661
            }
3662
            $refECF = $nfRef->getElementsByTagName('refECF');
3663
            foreach ($refECF as $umaRefNFe) {
3664
                $mod   = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3665
                $nECF  = $umaRefNFe->getElementsByTagName('nECF')->item(0)->nodeValue;
3666
                $nCOO  = $umaRefNFe->getElementsByTagName('nCOO')->item(0)->nodeValue;
3667
                $saida .= sprintf($formaECFRef, $mod, $nECF, $nCOO);
3668
            }
3669
            $refNFP = $nfRef->getElementsByTagName('refNFP');
3670
            foreach ($refNFP as $umaRefNFe) {
3671
                $data   = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3672
                $cnpj   = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3673
                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue :
3674
                    '';
3675
                $cpf    = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3676
                    $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : '';
3677
                $mod    = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3678
                $serie  = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
3679
                $numero = $umaRefNFe->getElementsByTagName('nNF')->item(0)->nodeValue;
3680
                $ie     = $umaRefNFe->getElementsByTagName('IE')->item(0)->nodeValue;
3681
                $data   = substr($data, 2, 2) . "/20" . substr($data, 0, 2);
3682
                if ($cnpj == '') {
3683
                    $cpf_cnpj = $this->formatField($cpf, "###.###.###-##");
3684
                } else {
3685
                    $cpf_cnpj = $this->formatField($cnpj, "##.###.###/####-##");
3686
                }
3687
                $saida .= sprintf($formaNfpRef, $serie, $numero, $cpf_cnpj, $data, $mod, $ie);
3688
            }
3689
        }
3690
3691
        return $saida;
3692
    }
3693
3694
    private function loadDoc($xml)
3695
    {
3696
        $this->xml = $xml;
3697
        if (! empty($xml)) {
3698
            $this->dom = new Dom();
3699
            $this->dom->loadXML($this->xml);
3700
            if (empty($this->dom->getElementsByTagName("infNFe")->item(0))) {
3701
                throw new \Exception('Isso não é um NFe.');
3702
            }
3703
            $this->nfeProc = $this->dom->getElementsByTagName("nfeProc")->item(0);
3704
            $this->infNFe  = $this->dom->getElementsByTagName("infNFe")->item(0);
3705
            $this->ide     = $this->dom->getElementsByTagName("ide")->item(0);
3706
            if ($this->getTagValue($this->ide, "mod") != '55') {
3707
                throw new \Exception("O xml deve ser NF-e modelo 55.");
3708
            }
3709
            $this->entrega    = $this->dom->getElementsByTagName("entrega")->item(0);
3710
            $this->retirada   = $this->dom->getElementsByTagName("retirada")->item(0);
3711
            $this->emit       = $this->dom->getElementsByTagName("emit")->item(0);
3712
            $this->dest       = $this->dom->getElementsByTagName("dest")->item(0);
3713
            $this->enderEmit  = $this->dom->getElementsByTagName("enderEmit")->item(0);
3714
            $this->enderDest  = $this->dom->getElementsByTagName("enderDest")->item(0);
3715
            $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...
3716
            $this->cobr       = $this->dom->getElementsByTagName("cobr")->item(0);
3717
            $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...
3718
            $this->ICMSTot    = $this->dom->getElementsByTagName("ICMSTot")->item(0);
3719
            $this->ISSQNtot   = $this->dom->getElementsByTagName("ISSQNtot")->item(0);
3720
            $this->transp     = $this->dom->getElementsByTagName("transp")->item(0);
3721
            $this->transporta = $this->dom->getElementsByTagName("transporta")->item(0);
3722
            $this->veicTransp = $this->dom->getElementsByTagName("veicTransp")->item(0);
3723
            $this->detPag     = $this->dom->getElementsByTagName("detPag");
3724
            $this->reboque    = $this->dom->getElementsByTagName("reboque")->item(0);
3725
            $this->infAdic    = $this->dom->getElementsByTagName("infAdic")->item(0);
3726
            $this->compra     = $this->dom->getElementsByTagName("compra")->item(0);
3727
            $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...
3728
            $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...
3729
            $this->infProt    = $this->dom->getElementsByTagName("infProt")->item(0);
3730
        }
3731
    }
3732
3733
    /**
3734
     * @param $item
3735
     *
3736
     * @return float
3737
     */
3738
    protected function calculeHeight($item)
3739
    {
3740
        if ($this->orientacao == 'P') {
3741
            $w = $this->wPrint;
3742
        } else {
3743
            $w = $this->wPrint - $this->wCanhoto;
3744
        }
3745
        $w2           = round($w * 0.25, 0);
3746
        $aFont        = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
3747
        $textoProduto = $this->descricaoProduto($item);
3748
        $numlinhas    = $this->pdf->getNumLines($textoProduto, $w2, $aFont);
3749
3750
        return round(($numlinhas * $this->pdf->fontSize) + ($numlinhas * 0.5), 2);
3751
    }
3752
}
3753