Completed
Pull Request — master (#358)
by Roberto
03:32
created

Danfe::calculoItensPorPagina()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace NFePHP\DA\NFe;
4
5
use InvalidArgumentException;
6
use NFePHP\DA\Legacy\Dom;
7
use NFePHP\DA\Legacy\Pdf;
8
use \NFePHP\DA\Common\DaCommon;
9
10
class Danfe extends DaCommon
11
{
12
13
    /**
14
     * Posição
15
     * @var float
16
     */
17
    protected $yDados = 0;
18
    /**
19
     * Parâmetro para exibir ou ocultar os valores do PIS/COFINS.
20
     * @var boolean
21
     */
22
    protected $qCanhoto = 1;
23
    /**
24
     * Define a exbição dos valores de PIS e Cofins
25
     * @var bool
26
     */
27
    protected $exibirPIS = true;
28
    /**
29
     * Parâmetro para exibir ou ocultar os valores do ICMS Interestadual e Valor Total dos Impostos.
30
     * @var boolean
31
     */
32
    protected $exibirIcmsInterestadual = true;
33
    /**
34
     * Parâmetro para exibir ou ocultar o texto sobre valor aproximado dos tributos.
35
     * @var boolean
36
     */
37
    protected $exibirValorTributos = true;
38
    /**
39
     * Parâmetro para exibir ou ocultar o texto adicional sobre a forma de pagamento
40
     * e as informações de fatura/duplicata.
41
     * @var boolean
42
     */
43
    protected $exibirTextoFatura = false;
44
    /**
45
     * Parâmetro do controle se deve concatenar automaticamente informações complementares
46
     * na descrição do produto, como por exemplo, informações sobre impostos.
47
     * @var boolean
48
     */
49
    public $descProdInfoComplemento = true;
50
    /**
51
     * Parâmetro do controle se deve gerar quebras de linha com "\n" a partir de ";" na descrição do produto.
52
     * @var boolean
53
     */
54
    protected $descProdQuebraLinha = true;
55
    /**
56
     * XML NFe
57
     * @var string
58
     */
59
    protected $xml;
60
    /**
61
     * mesagens de erro
62
     * @var string
63
     */
64
    protected $errMsg = '';
65
    /**
66
     * status de erro true um erro ocorreu false sem erros
67
     * @var boolean
68
     */
69
    protected $errStatus = false;
70
    /**
71
     * Texto adicional da DANFE
72
     * @var string
73
     */
74
    protected $textoAdic = '';
75
    /**
76
     * Largura
77
     * @var float
78
     */
79
    protected $wAdic = 0;
80
    /**
81
     * largura do canhoto (25mm) apenas para a formatação paisagem
82
     * @var float
83
     */
84
    protected $wCanhoto = 25;
85
    /**
86
     * Formato chave
87
     * @var string
88
     */
89
    protected $formatoChave = "#### #### #### #### #### #### #### #### #### #### ####";
90
    /**
91
     * quantidade de itens já processados na montagem do DANFE
92
     * @var integer
93
     */
94
    protected $qtdeItensProc;
95
    /**
96
     * Dom Document
97
     * @var \NFePHP\DA\Legacy\Dom
98
     */
99
    protected $dom;
100
    /**
101
     * Node
102
     * @var \DOMNode
103
     */
104
    protected $infNFe;
105
    /**
106
     * Node
107
     * @var \DOMNode
108
     */
109
    protected $ide;
110
    /**
111
     * Node
112
     * @var \DOMNode
113
     */
114
    protected $entrega;
115
    /**
116
     * Node
117
     * @var \DOMNode
118
     */
119
    protected $retirada;
120
    /**
121
     * Node
122
     * @var \DOMNode
123
     */
124
    protected $emit;
125
    /**
126
     * Node
127
     * @var \DOMNode
128
     */
129
    protected $dest;
130
    /**
131
     * Node
132
     * @var \DOMNode
133
     */
134
    protected $enderEmit;
135
    /**
136
     * Node
137
     * @var \DOMNode
138
     */
139
    protected $enderDest;
140
    /**
141
     * Node
142
     * @var \DOMNode
143
     */
144
    protected $det;
145
    /**
146
     * Node
147
     * @var \DOMNode
148
     */
149
    protected $cobr;
150
    /**
151
     * Node
152
     * @var \DOMNode
153
     */
154
    protected $dup;
155
    /**
156
     * Node
157
     * @var \DOMNode
158
     */
159
    protected $ICMSTot;
160
    /**
161
     * Node
162
     * @var \DOMNode
163
     */
164
    protected $ISSQNtot;
165
    /**
166
     * Node
167
     * @var \DOMNode
168
     */
169
    protected $transp;
170
    /**
171
     * Node
172
     * @var \DOMNode
173
     */
174
    protected $transporta;
175
    /**
176
     * Node
177
     * @var \DOMNode
178
     */
179
    protected $veicTransp;
180
    /**
181
     * Node reboque
182
     * @var \DOMNode
183
     */
184
    protected $reboque;
185
    /**
186
     * Node infAdic
187
     * @var \DOMNode
188
     */
189
    protected $infAdic;
190
    /**
191
     * Tipo de emissão
192
     * @var integer
193
     */
194
    protected $tpEmis;
195
    /**
196
     * Node infProt
197
     * @var \DOMNode
198
     */
199
    protected $infProt;
200
    /**
201
     * 1-Retrato/ 2-Paisagem
202
     * @var integer
203
     */
204
    protected $tpImp;
205
    /**
206
     * Node compra
207
     * @var \DOMNode
208
     */
209
    protected $compra;
210
    /**
211
     * @var int
212
     */
213
    protected $textadicfontsize;
214
    /**
215
     * Número de casas para a quantidade de itens da unidade comercial.
216
     * @var integer
217
     */
218
    protected $qComCasasDec = 4;
219
220
    /**
221
     * Número de casas decimais para o valor da unidade comercial.
222
     * @var integer
223
     */
224
    protected $vUnComCasasDec = 4;
225
226
    /**
227
     * Configuração para determinar se irá exibir ou não informações
228
     * das unidades de medidas tributáveis.
229
     * @var boolean
230
     */
231
    protected $mostrarUnidadeTributavel = false;
232
    /**
233
     * @var int
234
     */
235
    protected $hdadosadic = 10;
236
237
    /**
238
     * __construct
239
     *
240
     * @name  __construct
241
     * @param string  $xml Conteúdo XML da NF-e (com ou sem a tag nfeProc)
242
     */
243
    public function __construct($xml)
244
    {
245
        $this->loadDoc($xml);
246
    }
247
248
249
    /**
250
     * Define se irá mostrar ou não dados as unidades de medidas tributaveis.
251
     * @param boolean $mostrarUnidadeTributavel
252
     */
253
    public function setMostrarUnidadeTributavel($mostrarUnidadeTributavel)
254
    {
255
        $this->mostrarUnidadeTributavel = $mostrarUnidadeTributavel;
256
    }
257
258
    /**
259
     * Define a quantidade de casas decimais para unidade comercial.
260
     * @param integer $vUnComCasasDec
261
     */
262
    public function setVUnComCasasDec($vUnComCasasDec)
263
    {
264
        $this->vUnComCasasDec = $vUnComCasasDec;
265
    }
266
267
    /**
268
     * Define a quantidade de casas decimais para unidade comercial.
269
     * @param integer $qComCasasDec
270
     */
271
    public function setQComCasasDec($qComCasasDec)
272
    {
273
        $this->qComCasasDec = $qComCasasDec;
274
    }
275
    
276
    protected function calculoEspacoVericalDadosAdicionais()
277
    {
278
        $this->textoAdic = '';
279
        //informações adicionais
280
        $fontProduto = [
281
            'font' => $this->fontePadrao,
282
            'size' => 8,
283
            'style' => ''
284
        ];
285
        $k = $this->pdf->k;
286
        $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...
287
        $this->textoAdic .= $this->geraInformacoesDasNotasReferenciadas();
288
        if (isset($this->infAdic)) {
289
            $i = 0;
290
            if ($this->textoAdic != '') {
291
                $this->textoAdic .= ". \n";
292
            }
293
            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infCpl"))
294
                ? 'Inf. Contribuinte: ' . $this->anfaveaDANFE($this->getTagValue($this->infAdic, "infCpl"))
295
                : '';
296
            $infPedido = $this->geraInformacoesDaTagCompra();
297
            if ($infPedido != "") {
298
                $this->textoAdic .= $infPedido;
299
            }
300
            $this->textoAdic .= $this->getTagValue($this->dest, "email", ' Email do Destinatário: ');
301
            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infAdFisco"))
302
                ? "\n Inf. fisco: " . $this->getTagValue($this->infAdic, "infAdFisco")
303
                : '';
304
            $obsCont = $this->infAdic->getElementsByTagName("obsCont");
305
            if (isset($obsCont)) {
306
                foreach ($obsCont as $obs) {
307
                    $campo =  $obsCont->item($i)->getAttribute("xCampo");
308
                    $xTexto = ! empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue)
309
                        ? $obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue
310
                        : '';
311
                    $this->textoAdic .= "\n" . $campo . ':  ' . trim($xTexto);
312
                    $i++;
313
                }
314
            }
315
        }
316
        //INCLUSO pela NT 2013.003 Lei da Transparência
317
        //verificar se a informação sobre o valor aproximado dos tributos
318
        //já se encontra no campo de informações adicionais
319
        if ($this->exibirValorTributos) {
320
            $flagVTT = strpos(strtolower(trim($this->textoAdic)), 'valor');
321
            $flagVTT = $flagVTT || strpos(strtolower(trim($this->textoAdic)), 'vl');
322
            $flagVTT = $flagVTT && strpos(strtolower(trim($this->textoAdic)), 'aprox');
323
            $flagVTT = $flagVTT && (strpos(strtolower(trim($this->textoAdic)), 'trib') ||
324
                    strpos(strtolower(trim($this->textoAdic)), 'imp'));
325
            $vTotTrib = $this->getTagValue($this->ICMSTot, 'vTotTrib');
326
            if ($vTotTrib != '' && !$flagVTT) {
327
                $this->textoAdic .= "\n Valor Aproximado dos Tributos : R$ "
328
                    . number_format($vTotTrib, 2, ",", ".");
329
            }
330
        }
331
        //fim da alteração NT 2013.003 Lei da Transparência
332
        $this->textoAdic = str_replace(";", "\n", $this->textoAdic);
333
        $alinhas = explode("\n", $this->textoAdic);
0 ignored issues
show
Unused Code introduced by
$alinhas 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...
334
        $numlinhasdados = $this->pdf->getNumLines($this->textoAdic, $this->wAdic, $fontProduto)+1.5;
335
        $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...
336
        $hdadosadic = ceil($numlinhasdados * ($this->textadicfontsize));
337
        if ($hdadosadic > 70) {
338
            for ($f = 8; $f > 3; $f--) {
339
                $this->pdf->setFont($this->fontePadrao, '', $f);
340
                $fontProduto = [
341
                    'font' => $this->fontePadrao,
342
                    'size' => $f,
343
                    'style' => ''
344
                ];
345
                $numlinhasdados = $this->pdf->getNumLines($this->textoAdic, $this->wAdic, $fontProduto)+3;
346
                $this->textadicfontsize = $this->pdf->fontSize;
347
                $hdadosadic = ceil($numlinhasdados * $this->textadicfontsize);
348
                echo $hdadosadic;
349
                if ($hdadosadic <= 90) {
350
                    $hdadosadic = ceil($hdadosadic);
351
                    break;
352
                }
353
            }
354
        }
355
        if ($hdadosadic < 10) {
356
            $hdadosadic = 10;
357
        }
358
        return $hdadosadic;
359
    }
360
    
361
    protected function calculoItensPorPagina()
362
    {
363
        
364
    }
365
366
    /**
367
     * monta
368
     * Monta a DANFE conforme as informações fornecidas para a classe durante sua
369
     * construção. Constroi DANFEs com até 3 páginas podendo conter até 56 itens.
370
     * A definição de margens e posições iniciais para a impressão são estabelecidas
371
     * pelo conteúdo da funçao e podem ser modificados.
372
     *
373
374
     * @return string O ID da NFe numero de 44 digitos extraido do arquivo XML
375
     */
376
    protected function monta(
377
        $logo = ''
378
    ) {
379
        $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...
380
        $this->logomarca = $this->adjustImage($logo);
381
        //se a orientação estiver em branco utilizar o padrão estabelecido na NF
382
        if (empty($this->orientacao)) {
383
            if ($this->tpImp == '2') {
384
                $this->orientacao = 'L';
385
            } else {
386
                $this->orientacao = 'P';
387
            }
388
        }
389
        //instancia a classe pdf
390
        $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...
391
        //margens do PDF, em milímetros. Obs.: a margem direita é sempre igual à
392
        //margem esquerda. A margem inferior *não* existe na FPDF, é definida aqui
393
        //apenas para controle se necessário ser maior do que a margem superior
394
        // posição inicial do conteúdo, a partir do canto superior esquerdo da página
395
        $xInic = $this->margesq;
396
        if ($this->orientacao == 'P') {
397
            if ($this->papel == 'A4') {
398
                $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...
399
                $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...
400
            }
401
        } else {
402
            if ($this->papel == 'A4') {
403
                $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...
404
                $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...
405
                $xInic = $this->margesq+10;
406
                //se paisagem multiplica a largura do canhoto pela quantidade de canhotos
407
                //$this->wCanhoto *= $this->qCanhoto;
408
            }
409
        }
410
        //total inicial de paginas
411
        $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...
412
        //largura imprimivel em mm: largura da folha menos as margens esq/direita
413
        $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...
414
        //comprimento (altura) imprimivel em mm: altura da folha menos as margens
415
        //superior e inferior
416
        $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...
417
        // estabelece contagem de paginas
418
        $this->pdf->aliasNbPages();
419
        // fixa as margens
420
        $this->pdf->setMargins($this->margesq, $this->margsup);
421
        $this->pdf->setDrawColor(0, 0, 0);
422
        $this->pdf->setFillColor(255, 255, 255);
423
        // inicia o documento
424
        $this->pdf->open();
425
        // adiciona a primeira página
426
        $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...
427
        $this->pdf->setLineWidth(0.1);
428
        $this->pdf->settextcolor(0, 0, 0);
429
430
        //##################################################################
431
        // CALCULO DO NUMERO DE PAGINAS A SEREM IMPRESSAS
432
        //##################################################################
433
        //Verificando quantas linhas serão usadas para impressão das duplicatas
434
        $linhasDup = 0;
435
        $qtdPag = 0;
436
        if (isset($this->dup) && $this->dup->length > 0) {
437
            $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...
438
        } 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...
439
            $qtdPag = $this->detPag->length;
440
        }
441
        if (($qtdPag > 0) && ($qtdPag <= 7)) {
442
            $linhasDup = 1;
443
        } elseif (($qtdPag > 7) && ($qtdPag <= 14)) {
444
            $linhasDup = 2;
445
        } elseif (($qtdPag > 14) && ($qtdPag <= 21)) {
446
            $linhasDup = 3;
447
        } elseif ($qtdPag > 21) {
448
            // chinnonsantos 11/05/2016: Limite máximo de impressão de duplicatas na NFe,
449
            // só vai ser exibito as 21 primeiras duplicatas (parcelas de pagamento),
450
            // se não oculpa espaço d+, cada linha comporta até 7 duplicatas.
451
            $linhasDup = 3;
452
        }
453
        //verifica se será impressa a linha dos serviços ISSQN
454
        $linhaISSQN = 0;
455
        if ((isset($this->ISSQNtot)) && ($this->getTagValue($this->ISSQNtot, 'vServ') > 0)) {
456
            $linhaISSQN = 1;
457
        }
458
        //calcular a altura necessária para os dados adicionais
459
        if ($this->orientacao == 'P') {
460
            $this->wAdic = round($this->wPrint*0.66, 0);
461
        } else {
462
            $this->wAdic = round(($this->wPrint-$this->wCanhoto)*0.5, 0);
463
        }
464
        $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...
465
        
466
        $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...
467
        
468
        //altura disponivel para os campos da DANFE
469
        $hcabecalho = 47;//para cabeçalho
470
        $hdestinatario = 25;//para destinatario
471
        $hduplicatas = 12;//para cada grupo de 7 duplicatas
472
        if (isset($this->entrega)) {
473
            $hlocalentrega = 25;
474
        } else {
475
            $hlocalentrega = 0;
476
        }
477
        if (isset($this->retirada)) {
478
            $hlocalretirada = 25;
479
        } else {
480
            $hlocalretirada = 0;
481
        }
482
        $himposto = 18;// para imposto
483
        $htransporte = 25;// para transporte
484
        $hissqn = 11;// para issqn
485
        $hfooter = 5;// para rodape
486
        $hCabecItens = 4;//cabeçalho dos itens
487
        //
488
        $hOCUPADA = 
489
            $hcabecalho
490
            + $hdestinatario
491
            + $hlocalentrega
492
            + $hlocalretirada
493
            + ($linhasDup * $hduplicatas)
494
            + $himposto + $htransporte
495
            + ($linhaISSQN * $hissqn)
496
            + $this->hdadosadic
497
            + $hfooter
498
            + $hCabecItens
499
            + $this->sizeExtraTextoFatura();
500
        
501
        //alturas disponiveis para os dados
502
        $hDispo1 = $this->hPrint - $hOCUPADA;
503
            /*($hcabecalho +
504
            //$hdestinatario + ($linhasDup * $hduplicatas) + $himposto + $htransporte +
505
            $hdestinatario + $hlocalentrega + $hlocalretirada +
506
            ($linhasDup * $hduplicatas) + $himposto + $htransporte +
507
            ($linhaISSQN * $hissqn) + $this->hdadosadic + $hfooter + $hCabecItens +
508
            $this->sizeExtraTextoFatura());*/
509
        
510
        if ($this->orientacao == 'P') {
511
            $hDispo1 -= 24 * $this->qCanhoto;//para canhoto
512
            $w = $this->wPrint;
513
        } else {
514
            $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...
515
            $w = $this->wPrint - $this->wCanhoto;
516
        }
517
        //$hDispo1 += 14;
518
        $hDispo2 = $this->hPrint - ($hcabecalho + $hfooter + $hCabecItens);
519
        //Contagem da altura ocupada para impressão dos itens
520
        $fontProduto = ['font' => $this->fontePadrao, 'size' => 7, 'style' => ''];
521
        $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...
522
        $hUsado = $hCabecItens;
523
        $w2 = round($w*0.28, 0);
524
        $hDispo = $hDispo1;
525
        $totPag = 1;
526
        $i = 0;
527
        while ($i < $this->det->length) {
528
            $texto = $this->descricaoProduto($this->det->item($i));
529
            $numlinhas = $this->pdf->getNumLines($texto, $w2, $fontProduto);
530
            if ($this->mostrarUnidadeTributavel && $numlinhas == 1) {
531
                $numlinhas = 2;
532
            }
533
            $hUsado += round(($numlinhas * $this->pdf->fontSize) + ($numlinhas * 0.5), 2);
534
            if ($hUsado > $hDispo) {
535
                $totPag++;
536
                $hDispo = $hDispo2;
537
                $hUsado = $hCabecItens;
538
                // Remove canhoto para páginas secundárias em modo paisagem ('L')
539
                $w2 = round($this->wPrint*0.28, 0);
540
                $i--; // decrementa para readicionar o item que não coube nessa pagina na outra.
541
            }
542
            $i++;
543
        } //fim da soma das areas de itens usadas
544
        $qtdeItens = $i; //controle da quantidade de itens no DANFE
545
        //montagem da primeira página
546
        $pag = 1;
547
        
548
        $x = $this->margesq;
549
        $y = $this->margsup;
550
        //coloca o(s) canhoto(s) da NFe
551
        if ($this->orientacao == 'P') {
552
            $y = $this->canhoto($this->margesq, $this->margsup);
553
        } else {
554
            $this->canhoto($this->margesq, $this->margsup);
555
            $x = 25;
556
        }
557
        //coloca o cabeçalho
558
        $y = $this->header($x, $y, $pag, $totPag);
559
        //coloca os dados do destinatário
560
        $y = $this->destinatarioDANFE($x, $y+1);
561
        //coloca os dados do local de retirada
562
        if (isset($this->retirada)) {
563
            $y = $this->localRetiradaDANFE($x, $y+1);
564
        }
565
        //coloca os dados do local de entrega
566
        if (isset($this->entrega)) {
567
            $y = $this->localEntregaDANFE($x, $y+1);
568
        }
569
        
570
        //Verifica as formas de pagamento da nota fiscal
571
        $formaPag = [];
572
        if (isset($this->detPag) && $this->detPag->length > 0) {
573
            foreach ($this->detPag as $k => $d) {
574
                $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
575
                ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue
576
                : '0';
577
                $formaPag[$fPag] = $fPag;
578
            }
579
        }
580
        //caso tenha boleto imprimir fatura
581
        if ($this->dup->length > 0) {
582
            $y = $this->fatura($x, $y+1);
583
        } else {
584
            //Se somente tiver a forma de pagamento sem pagamento ou outros não imprimir nada
585
            if (count($formaPag)=='1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
586
                $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...
587
            } else {
588
                //caso tenha mais de uma forma de pagamento ou seja diferente de boleto exibe a
589
                //forma de pagamento e o valor
590
                $y = $this->pagamento($x, $y+1);
591
            }
592
        }
593
        //coloca os dados dos impostos e totais da NFe
594
        $y = $this->imposto($x, $y+1);
595
        //coloca os dados do trasnporte
596
        $y = $this->transporte($x, $y+1);
597
        //itens da DANFE
598
        $nInicial = 0;
599
600
        $y = $this->itens($x, $y+1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
601
602
        //coloca os dados do ISSQN
603
        if ($linhaISSQN == 1) {
604
            $y = $this->issqn($x, $y+4);
605
        } else {
606
            $y += 4;
607
        }
608
        //coloca os dados adicionais da NFe
609
        $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...
610
        //coloca o rodapé da página
611
        if ($this->orientacao == 'P') {
612
            $this->rodape($xInic);
613
        } else {
614
            $this->rodape($xInic);
615
        }
616
617
        //loop para páginas seguintes
618
        for ($n = 2; $n <= $totPag; $n++) {
619
            // fixa as margens
620
            $this->pdf->setMargins($this->margesq, $this->margsup);
621
            //adiciona nova página
622
            $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...
623
            //ajusta espessura das linhas
624
            $this->pdf->setLineWidth(0.1);
625
            //seta a cor do texto para petro
626
            $this->pdf->settextcolor(0, 0, 0);
627
            // posição inicial do relatorio
628
            $x = $this->margesq;
629
            $y = $this->margsup;
630
            //coloca o cabeçalho na página adicional
631
            $y = $this->header($x, $y, $n, $totPag);
632
            //coloca os itens na página adicional
633
            $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...
634
            //coloca o rodapé da página
635
            if ($this->orientacao == 'P') {
636
                $this->rodape($this->margesq);
637
            } else {
638
                $this->rodape($this->margesq);
639
            }
640
            //se estiver na última página e ainda restar itens para inserir, adiciona mais uma página
641
            if ($n == $totPag && $this->qtdeItensProc < $qtdeItens) {
642
                $totPag++;
643
            }
644
        }
645
    }
646
647
    /**
648
     * anfavea
649
     * Função para transformar o campo cdata do padrão ANFAVEA para
650
     * texto imprimível
651
     *
652
     * @param  string $cdata campo CDATA
653
     * @return string conteúdo do campo CDATA como string
654
     */
655
    protected function anfaveaDANFE($cdata = '')
656
    {
657
        if ($cdata == '') {
658
            return '';
659
        }
660
        //remove qualquer texto antes ou depois da tag CDATA
661
        $cdata = str_replace('<![CDATA[', '<CDATA>', $cdata);
662
        $cdata = str_replace(']]>', '</CDATA>', $cdata);
663
        $cdata = preg_replace('/\s\s+/', ' ', $cdata);
664
        $cdata = str_replace("> <", "><", $cdata);
665
        $len = strlen($cdata);
666
        $startPos = strpos($cdata, '<');
667
        if ($startPos === false) {
668
            return $cdata;
669
        }
670
        for ($x=$len; $x>0; $x--) {
671
            if (substr($cdata, $x, 1) == '>') {
672
                $endPos = $x;
673
                break;
674
            }
675
        }
676
        if ($startPos > 0) {
677
            $parte1 = substr($cdata, 0, $startPos);
678
        } else {
679
            $parte1 = '';
680
        }
681
        $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...
682
        if ($endPos < $len) {
683
            $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
684
        } else {
685
            $parte3 = '';
686
        }
687
        $texto = trim($parte1).' '.trim($parte3);
688
        if (strpos($parte2, '<CDATA>') === false) {
689
            $cdata = '<CDATA>'.$parte2.'</CDATA>';
690
        } else {
691
            $cdata = $parte2;
692
        }
693
        //Retira a tag <FONTE IBPT> (caso existir) pois não é uma estrutura válida XML
694
        $cdata = str_replace('<FONTE IBPT>', '', $cdata);
695
        //carrega o xml CDATA em um objeto DOM
696
        $dom = new Dom();
697
        $dom->loadXML($cdata, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG);
698
        //$xml = $dom->saveXML();
699
        //grupo CDATA infADprod
700
        $id = $dom->getElementsByTagName('id')->item(0);
701
        $div = $dom->getElementsByTagName('div')->item(0);
702
        $entg = $dom->getElementsByTagName('entg')->item(0);
703
        $dest = $dom->getElementsByTagName('dest')->item(0);
704
        $ctl = $dom->getElementsByTagName('ctl')->item(0);
705
        $ref = $dom->getElementsByTagName('ref')->item(0);
706
        if (isset($id)) {
707
            if ($id->hasAttributes()) {
708
                foreach ($id->attributes as $attr) {
709
                    $name = $attr->nodeName;
710
                    $value = $attr->nodeValue;
711
                    $texto .= " $name : $value";
712
                }
713
            }
714
        }
715
        if (isset($div)) {
716
            if ($div->hasAttributes()) {
717
                foreach ($div->attributes as $attr) {
718
                    $name = $attr->nodeName;
719
                    $value = $attr->nodeValue;
720
                    $texto .= " $name : $value";
721
                }
722
            }
723
        }
724
        if (isset($entg)) {
725
            if ($entg->hasAttributes()) {
726
                foreach ($entg->attributes as $attr) {
727
                    $name = $attr->nodeName;
728
                    $value = $attr->nodeValue;
729
                    $texto .= " $name : $value";
730
                }
731
            }
732
        }
733
        if (isset($dest)) {
734
            if ($dest->hasAttributes()) {
735
                foreach ($dest->attributes as $attr) {
736
                    $name = $attr->nodeName;
737
                    $value = $attr->nodeValue;
738
                    $texto .= " $name : $value";
739
                }
740
            }
741
        }
742
        if (isset($ctl)) {
743
            if ($ctl->hasAttributes()) {
744
                foreach ($ctl->attributes as $attr) {
745
                    $name = $attr->nodeName;
746
                    $value = $attr->nodeValue;
747
                    $texto .= " $name : $value";
748
                }
749
            }
750
        }
751
        if (isset($ref)) {
752
            if ($ref->hasAttributes()) {
753
                foreach ($ref->attributes as $attr) {
754
                    $name = $attr->nodeName;
755
                    $value = $attr->nodeValue;
756
                    $texto .= " $name : $value";
757
                }
758
            }
759
        }
760
        //grupo CADATA infCpl
761
        $t = $dom->getElementsByTagName('transmissor')->item(0);
762
        $r = $dom->getElementsByTagName('receptor')->item(0);
763
        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
764
            'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
765
        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
766
            'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
767
        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
768
            'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
769
        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
770
            'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
771
        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
772
        if (isset($t)) {
773
            if ($t->hasAttributes()) {
774
                $texto .= " Transmissor ";
775
                foreach ($t->attributes as $attr) {
776
                    $name = $attr->nodeName;
777
                    $value = $attr->nodeValue;
778
                    $texto .= " $name : $value";
779
                }
780
            }
781
        }
782
        if (isset($r)) {
783
            if ($r->hasAttributes()) {
784
                $texto .= " Receptor ";
785
                foreach ($r->attributes as $attr) {
786
                    $name = $attr->nodeName;
787
                    $value = $attr->nodeValue;
788
                    $texto .= " $name : $value";
789
                }
790
            }
791
        }
792
        return $texto;
793
    }
794
795
    /**
796
     * Verifica o status da NFe
797
     *
798
     * @return array
799
     */
800
    protected function statusNFe()
801
    {
802
        if (!isset($this->nfeProc)) {
803
            return ['status' => false, 'message' => 'NFe NÃO PROTOCOLADA'];
804
        }
805
        if ($this->getTagValue($this->ide, "tpAmb") == '2') {
806
            return ['status' => false, 'message' => 'NFe EMITIDA EM HOMOLOGAÇÃO'];
807
        }
808
        $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...
809
        if ($cStat == '101'
810
            || $cStat == '151'
811
            || $cStat == '135'
812
            || $cStat == '155'
813
        ) {
814
            return ['status' => false, 'message' => 'NFe CANCELADA'];
815
        }
816
        
817
        if ($cStat == '110' ||
818
               $cStat == '301' ||
819
               $cStat == '302'
820
               
821
        ) {
822
            return ['status' => false, 'message' => 'NFe DENEGADA'];
823
        }
824
        return ['status' => true, 'message' => ''];
825
    }
826
827
    protected function notaDPEC()
828
    {
829
        return !empty($this->numdepec);
830
    }
831
832
    /**
833
     *header
834
     * Monta o cabelhalho da DANFE (retrato e paisagem)
835
     *
836
     * @param  number $x      Posição horizontal inicial, canto esquerdo
837
     * @param  number $y      Posição vertical inicial, canto superior
838
     * @param  number $pag    Número da Página
839
     * @param  number $totPag Total de páginas
840
     * @return number Posição vertical final
841
     */
842
    protected function header($x = 0, $y = 0, $pag = '1', $totPag = '1')
843
    {
844
        $oldX = $x;
845
        $oldY = $y;
846
        if ($this->orientacao == 'P') {
847
              $maxW = $this->wPrint;
848
        } else {
849
            if ($pag == 1) { // primeira página
850
                $maxW = $this->wPrint - $this->wCanhoto;
851
            } else { // páginas seguintes
852
                $maxW = $this->wPrint;
853
            }
854
        }
855
        //####################################################################################
856
        //coluna esquerda identificação do emitente
857
        $w = round($maxW*0.41, 0);
858
        if ($this->orientacao == 'P') {
859
            $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
860
        } else {
861
            $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
862
        }
863
        $w1 = $w;
864
        $h=32;
865
        $oldY += $h;
866
        $this->pdf->textBox($x, $y, $w, $h);
867
        $texto = 'IDENTIFICAÇÃO DO EMITENTE';
868
        $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...
869
        //estabelecer o alinhamento
870
        //pode ser left L, center C, right R, full logo L
871
        //se for left separar 1/3 da largura para o tamanho da imagem
872
        //os outros 2/3 serão usados para os dados do emitente
873
        //se for center separar 1/2 da altura para o logo e 1/2 para os dados
874
        //se for right separa 2/3 para os dados e o terço seguinte para o logo
875
        //se não houver logo centraliza dos dados do emitente
876
        // coloca o logo
877
        if (!empty($this->logomarca)) {
878
            $logoInfo = getimagesize($this->logomarca);
879
            //largura da imagem em mm
880
            $logoWmm = ($logoInfo[0]/72)*25.4;
881
            //altura da imagem em mm
882
            $logoHmm = ($logoInfo[1]/72)*25.4;
883
            if ($this->logoAlign=='L') {
884
                $nImgW = round($w/3, 0);
885
                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
886
                $xImg = $x+1;
887
                $yImg = round(($h-$nImgH)/2, 0)+$y;
888
                //estabelecer posições do texto
889
                $x1 = round($xImg + $nImgW +1, 0);
890
                $y1 = round($h/3+$y, 0);
891
                $tw = round(2*$w/3, 0);
892
            } elseif ($this->logoAlign=='C') {
893
                $nImgH = round($h/3, 0);
894
                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
895
                $xImg = round(($w-$nImgW)/2+$x, 0);
896
                $yImg = $y+3;
897
                $x1 = $x;
898
                $y1 = round($yImg + $nImgH + 1, 0);
899
                $tw = $w;
900
            } elseif ($this->logoAlign=='R') {
901
                $nImgW = round($w/3, 0);
902
                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
903
                $xImg = round($x+($w-(1+$nImgW)), 0);
904
                $yImg = round(($h-$nImgH)/2, 0)+$y;
905
                $x1 = $x;
906
                $y1 = round($h/3+$y, 0);
907
                $tw = round(2*$w/3, 0);
908
            } elseif ($this->logoAlign=='F') {
909
                $nImgH = round($h-5, 0);
910
                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
911
                $xImg = round(($w-$nImgW)/2+$x, 0);
912
                $yImg = $y+3;
913
                $x1 = $x;
914
                $y1 = round($yImg + $nImgH + 1, 0);
915
                $tw = $w;
916
            }
917
            $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...
918
            $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...
919
        } else {
920
            $x1 = $x;
921
            $y1 = round($h/3+$y, 0);
922
            $tw = $w;
923
        }
924
        // monta as informações apenas se diferente de full logo
925
        if ($this->logoAlign !== 'F') {
926
            //Nome emitente
927
            $aFont = ['font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B'];
928
            $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
929
            $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...
930
            //endereço
931
            $y1 = $y1+5;
932
            $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
933
            $fone = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
934
            ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
935
            : '';
936
            $lgr = $this->getTagValue($this->enderEmit, "xLgr");
937
            $nro = $this->getTagValue($this->enderEmit, "nro");
938
            $cpl = $this->getTagValue($this->enderEmit, "xCpl", " - ");
939
            $bairro = $this->getTagValue($this->enderEmit, "xBairro");
940
            $CEP = $this->getTagValue($this->enderEmit, "CEP");
941
            $CEP = $this->formatField($CEP, "#####-###");
942
            $mun = $this->getTagValue($this->enderEmit, "xMun");
943
            $UF = $this->getTagValue($this->enderEmit, "UF");
944
            $texto = $lgr . ", " . $nro . $cpl . "\n" . $bairro . " - "
945
                . $CEP . "\n" . $mun . " - " . $UF . " "
946
                . "Fone/Fax: " . $fone;
947
            $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...
948
        }
949
950
        //####################################################################################
951
        //coluna central Danfe
952
        $x += $w;
953
        $w=round($maxW * 0.17, 0);//35;
954
        $w2 = $w;
955
        $h = 32;
956
        $this->pdf->textBox($x, $y, $w, $h);
957
  
958
        $texto = "DANFE";
959
        $aFont = ['font'=>$this->fontePadrao, 'size'=>14, 'style'=>'B'];
960
        $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...
961
        $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
962
        $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
963
        $h = 20;
964
        $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...
965
966
        $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
967
        $texto = '0 - ENTRADA';
968
        $y1 = $y + 14;
969
        $h = 8;
970
        $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...
971
        $texto = '1 - SAÍDA';
972
        $y1 = $y + 17;
973
        $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...
974
        //tipo de nF
975
        $aFont = ['font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B'];
976
        $y1 = $y + 13;
977
        $h = 7;
978
        $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
979
        $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...
980
        //numero da NF
981
        $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
982
        $y1 = $y + 20;
983
        $numNF = str_pad(
984
            $this->ide->getElementsByTagName('nNF')->item(0)->nodeValue,
985
            9,
986
            "0",
987
            STR_PAD_LEFT
988
        );
989
        $numNF = $this->formatField($numNF, "###.###.###");
990
        $texto = "Nº. " . $numNF;
991
        $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...
992
        //Série
993
        $y1 = $y + 23;
994
        $serie = str_pad(
995
            $this->ide->getElementsByTagName('serie')->item(0)->nodeValue,
996
            3,
997
            "0",
998
            STR_PAD_LEFT
999
        );
1000
        $texto = "Série " . $serie;
1001
        $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...
1002
        //numero paginas
1003
        $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'I'];
1004
        $y1 = $y + 26;
1005
        $texto = "Folha " . $pag . "/" . $totPag;
1006
        $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...
1007
1008
        //####################################################################################
1009
        //coluna codigo de barras
1010
        $x += $w;
1011
        $w = ($maxW-$w1-$w2);//85;
1012
        $w3 = $w;
1013
        $h = 32;
1014
        $this->pdf->textBox($x, $y, $w, $h);
1015
        $this->pdf->setFillColor(0, 0, 0);
1016
        $chave_acesso = str_replace('NFe', '', $this->infNFe->getAttribute("Id"));
1017
        $bW = 75;
1018
        $bH = 12;
1019
        //codigo de barras
1020
        $this->pdf->code128($x+(($w-$bW)/2), $y+2, $chave_acesso, $bW, $bH);
1021
        //linhas divisorias
1022
        $this->pdf->line($x, $y+4+$bH, $x+$w, $y+4+$bH);
1023
        $this->pdf->line($x, $y+12+$bH, $x+$w, $y+12+$bH);
1024
        $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1025
        $y1 = $y+4+$bH;
1026
        $h = 7;
1027
        $texto = 'CHAVE DE ACESSO';
1028
        $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...
1029
        $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
1030
        $y1 = $y+8+$bH;
1031
        $texto = $this->formatField($chave_acesso, $this->formatoChave);
1032
        $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...
1033
        $y1 = $y+12+$bH;
1034
        $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1035
        $chaveContingencia="";
1036
        if ($this->notaDpec()) {
1037
            $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC';
1038
        } else {
1039
            $cabecalhoProtoAutorizacao = 'PROTOCOLO DE AUTORIZAÇÃO DE USO';
1040
        }
1041
        if (($this->tpEmis == 2 || $this->tpEmis == 5) && !$this->notaDpec()) {
1042
            $cabecalhoProtoAutorizacao = "DADOS DA NF-E";
1043
            $chaveContingencia = $this->geraChaveAdicionalDeContingencia();
1044
            $this->pdf->setFillColor(0, 0, 0);
1045
            //codigo de barras
1046
            $this->pdf->code128($x+11, $y1+1, $chaveContingencia, $bW*.9, $bH/2);
1047
        } else {
1048
            $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1049
            $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...
1050
            $y1 = $y+16+$bH;
1051
            $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1052
            $this->pdf->textBox(
1053
                $x+2,
1054
                $y1,
1055
                $w-2,
1056
                $h,
1057
                $texto,
1058
                $aFont,
1059
                'T',
1060
                'C',
1061
                0,
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1062
                'http://www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora'
1063
            );
1064
        }
1065
1066
        //####################################################################################
1067
        //Dados da NF do cabeçalho
1068
        //natureza da operação
1069
        $texto = 'NATUREZA DA OPERAÇÃO';
1070
        $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1071
        $w = $w1+$w2;
1072
        $y = $oldY;
1073
        $oldY += $h;
1074
        $x = $oldX;
1075
        $h = 7;
1076
        $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...
1077
        $texto = $this->ide->getElementsByTagName("natOp")->item(0)->nodeValue;
1078
        $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1079
        $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...
1080
        $x += $w;
1081
        $w = $w3;
1082
        //PROTOCOLO DE AUTORIZAÇÃO DE USO ou DADOS da NF-E
1083
        $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1084
        $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...
1085
        // algumas NFe podem estar sem o protocolo de uso portanto sua existencia deve ser
1086
        // testada antes de tentar obter a informação.
1087
        // NOTA : DANFE sem protocolo deve existir somente no caso de contingência !!!
1088
        // Além disso, existem várias NFes em contingência que eu recebo com protocolo de autorização.
1089
        // Na minha opinião, deveríamos mostra-lo, mas o  manual  da NFe v4.01 diz outra coisa...
1090
        if (($this->tpEmis == 2 || $this->tpEmis == 5) && !$this->notaDpec()) {
1091
            $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
1092
            $texto = $this->formatField(
1093
                $chaveContingencia,
1094
                "#### #### #### #### #### #### #### #### ####"
1095
            );
1096
            $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...
1097
        } else {
1098
            $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1099
            if ($this->notaDpec()) {
1100
                $texto = $this->numdepec;
1101
                $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...
1102
            } else {
1103
                if (isset($this->nfeProc)) {
1104
                    $texto = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue)
1105
                    ? $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue
1106
                    : '';
1107
                    $tsHora = $this->toTimestamp(
1108
                        $this->nfeProc->getElementsByTagName("dhRecbto")->item(0)->nodeValue
1109
                    );
1110
                    if ($texto != '') {
1111
                        $texto .= "  -  " . date('d/m/Y H:i:s', $tsHora);
1112
                    }
1113
                    $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...
1114
                } else {
1115
                    $texto = '';
1116
                    $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...
1117
                }
1118
            }
1119
        }
1120
        $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...
1121
        //####################################################################################
1122
        //INSCRIÇÃO ESTADUAL
1123
        $w = round($maxW * 0.250, 0);
1124
        $y += $h;
1125
        $oldY += $h;
1126
        $x = $oldX;
1127
        $texto = 'INSCRIÇÃO ESTADUAL';
1128
        $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1129
        $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...
1130
        $texto = $this->getTagValue($this->emit, "IE");
1131
        $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1132
        $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...
1133
        //INSCRIÇÃO MUNICIPAL
1134
        $x += $w;
1135
        $texto = 'INSCRIÇÃO MUNICIPAL';
1136
        $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1137
        $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...
1138
        $texto = $this->getTagValue($this->emit, "IM");
1139
        $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1140
        $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...
1141
        //INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.
1142
        $x += $w;
1143
        $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.';
1144
        $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1145
        $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...
1146
        $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1147
        ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue
1148
        : '';
1149
        $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1150
        $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...
1151
        //CNPJ
1152
        $x += $w;
1153
        $w = ($maxW-(3 * $w));
1154
        $texto = 'CNPJ';
1155
        $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1156
        $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...
1157
        //Pegando valor do CPF/CNPJ
1158
        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1159
            $texto = $this->formatField(
1160
                $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1161
                "###.###.###/####-##"
1162
            );
1163
        } else {
1164
            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue)
1165
            ? $this->formatField(
1166
                $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1167
                "###.###.###-##"
1168
            )
1169
            : '';
1170
        }
1171
        $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1172
        $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...
1173
1174
        //####################################################################################
1175
        //Indicação de NF Homologação, cancelamento e falta de protocolo
1176
        $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...
1177
        //indicar cancelamento
1178
        $resp = $this->statusNFe();
1179
        if (!$resp['status']) {
1180
            $x = 10;
1181
            $y = $this->hPrint-130;
1182
            $h = 25;
1183
            $w = $maxW-(2*$x);
1184
            $this->pdf->settextcolor(90, 90, 90);
1185
            $texto = $resp['message'];
1186
            $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1187
            $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...
1188
            $y += $h;
1189
            $h = 5;
1190
            $w = $maxW-(2*$x);
1191
            if (isset($this->infProt) && $resp['status']) {
1192
                $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue;
1193
            } else {
1194
                $xMotivo = '';
1195
            }
1196
            $texto = "SEM VALOR FISCAL\n".$xMotivo;
1197
            $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1198
            $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...
1199
            $this->pdf->settextcolor(0, 0, 0);
1200
        }
1201
        if ($this->notaDpec() || $this->tpEmis == 4) {
1202
            //DPEC
1203
            $x = 10;
1204
            $y = $this->hPrint-130;
1205
            $h = 25;
1206
            $w = $maxW-(2*$x);
1207
            $this->pdf->SetTextColor(200, 200, 200);
1208
            $texto = "DANFE impresso em contingência -\n".
1209
                     "DPEC regularmente recebido pela Receita\n".
1210
                     "Federal do Brasil";
1211
            $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1212
            $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...
1213
            $this->pdf->SetTextColor(0, 0, 0);
1214
        }
1215
        return $oldY;
1216
    } //fim header
1217
1218
    /**
1219
     * destinatarioDANFE
1220
     * Monta o campo com os dados do destinatário na DANFE. (retrato e paisagem)
1221
     *
1222
     * @name   destinatarioDANFE
1223
     * @param  number $x Posição horizontal canto esquerdo
1224
     * @param  number $y Posição vertical canto superior
1225
     * @return number Posição vertical final
1226
     */
1227
    protected function destinatarioDANFE($x = 0, $y = 0)
1228
    {
1229
        //####################################################################################
1230
        //DESTINATÁRIO / REMETENTE
1231
        $oldX = $x;
1232
        $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...
1233
        if ($this->orientacao == 'P') {
1234
            $maxW = $this->wPrint;
1235
        } else {
1236
            $maxW = $this->wPrint - $this->wCanhoto;
1237
        }
1238
        $w = $maxW;
1239
        $h = 7;
1240
        $texto = 'DESTINATÁRIO / REMETENTE';
1241
        $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1242
        $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...
1243
        //NOME / RAZÃO SOCIAL
1244
        $w = round($maxW*0.61, 0);
1245
        $w1 = $w;
1246
        $y += 3;
1247
        $texto = 'NOME / RAZÃO SOCIAL';
1248
        $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1249
        $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...
1250
        $texto = $this->dest->getElementsByTagName("xNome")->item(0)->nodeValue;
1251
        $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1252
        if ($this->orientacao == 'P') {
1253
            $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...
1254
        } else {
1255
            $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...
1256
        }
1257
        //CNPJ / CPF
1258
        $x += $w;
1259
        $w = round($maxW*0.23, 0);
1260
        $w2 = $w;
1261
        $texto = 'CNPJ / CPF';
1262
        $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1263
        $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...
1264
        //Pegando valor do CPF/CNPJ
1265
        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1266
            $texto = $this->formatField(
1267
                $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1268
                "###.###.###/####-##"
1269
            );
1270
        } else {
1271
            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue)
1272
            ? $this->formatField(
1273
                $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1274
                "###.###.###-##"
1275
            )
1276
            : '';
1277
        }
1278
        $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1279
        $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...
1280
        //DATA DA EMISSÃO
1281
        $x += $w;
1282
        $w = $maxW-($w1+$w2);
1283
        $wx = $w;
1284
        $texto = 'DATA DA EMISSÃO';
1285
        $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1286
        $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...
1287
        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue)
1288
        ? $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue
1289
        : '';
1290
        if ($dEmi == '') {
1291
            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue)
1292
            ? $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue
1293
            : '';
1294
            $aDemi = explode('T', $dEmi);
1295
            $dEmi = $aDemi[0];
1296
        }
1297
        $texto = $this->ymdTodmy($dEmi);
1298
        $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1299
        if ($this->orientacao == 'P') {
1300
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1301
        } else {
1302
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', '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...
1303
        }
1304
        //ENDEREÇO
1305
        $w = round($maxW*0.47, 0);
1306
        $w1 = $w;
1307
        $y += $h;
1308
        $x = $oldX;
1309
        $texto = 'ENDEREÇO';
1310
        $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1311
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1312
        $texto = $this->dest->getElementsByTagName("xLgr")->item(0)->nodeValue;
1313
        $texto .= ', ' . $this->dest->getElementsByTagName("nro")->item(0)->nodeValue;
1314
        $texto .= $this->getTagValue($this->dest, "xCpl", " - ");
1315
1316
        $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1317
        $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...
1318
        //BAIRRO / DISTRITO
1319
        $x += $w;
1320
        $w = round($maxW*0.21, 0);
1321
        $w2 = $w;
1322
        $texto = 'BAIRRO / DISTRITO';
1323
        $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1324
        $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...
1325
        $texto = $this->dest->getElementsByTagName("xBairro")->item(0)->nodeValue;
1326
        $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1327
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

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

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1335
        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue)
1336
        ? $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue
1337
        : '';
1338
        $texto = $this->formatField($texto, "#####-###");
1339
        $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1340
        $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...
1341
        //DATA DA SAÍDA
1342
        $x += $w;
1343
        $w = $wx;
1344
        $texto = 'DATA DA SAÍDA/ENTRADA';
1345
        $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1346
        $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...
1347
        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue)
1348
            ? $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue
1349
            : '';
1350
        if ($dSaiEnt == '') {
1351
            $dSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1352
                ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1353
                : '';
1354
            $aDsaient = explode('T', $dSaiEnt);
1355
            $dSaiEnt = $aDsaient[0];
1356
        }
1357
        $texto = $this->ymdTodmy($dSaiEnt);
1358
        $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1359
        $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...
1360
        //MUNICÍPIO
1361
        $w = $w1;
1362
        $y += $h;
1363
        $x = $oldX;
1364
        $texto = 'MUNICÍPIO';
1365
        $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1366
        $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...
1367
        $texto = $this->dest->getElementsByTagName("xMun")->item(0)->nodeValue;
1368
        if (strtoupper(trim($texto)) == "EXTERIOR"
1369
            && $this->dest->getElementsByTagName("xPais")->length > 0
1370
        ) {
1371
            $texto .= " - " .  $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1372
        }
1373
        $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1374
        $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...
1375
        //UF
1376
        $x += $w;
1377
        $w = 8;
1378
        $texto = 'UF';
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 = $this->dest->getElementsByTagName("UF")->item(0)->nodeValue;
1382
        $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1383
        $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...
1384
        //FONE / FAX
1385
        $x += $w;
1386
        $w = round(($maxW -$w1-$wx-8)/2, 0);
1387
        $w3 = $w;
1388
        $texto = 'FONE / FAX';
1389
        $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1390
        $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...
1391
        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue)
1392
        ? $this->dest->getElementsByTagName("fone")->item(0)->nodeValue
1393
        : '';
1394
        $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1395
        $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...
1396
        //INSCRIÇÃO ESTADUAL
1397
        $x += $w;
1398
        $w = $maxW -$w1-$wx-8-$w3;
1399
        $texto = 'INSCRIÇÃO ESTADUAL';
1400
        $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1401
        $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...
1402
        $IE = $this->dest->getElementsByTagName("IE");
1403
        $texto = ($IE && $IE->length > 0) ? $IE->item(0)->nodeValue : '';
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
        //HORA DA SAÍDA
1407
        $x += $w;
1408
        $w = $wx;
1409
        $texto = 'HORA DA SAÍDA/ENTRADA';
1410
        $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1411
        $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...
1412
        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue)
1413
        ? $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue
1414
        : '';
1415
        if ($hSaiEnt == '') {
1416
            $dhSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue)
1417
            ? $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue
1418
            : '';
1419
            $tsDhSaiEnt = $this->toTimestamp($dhSaiEnt);
1420
            if ($tsDhSaiEnt != '') {
1421
                $hSaiEnt = date('H:i:s', $tsDhSaiEnt);
1422
            }
1423
        }
1424
        $texto = $hSaiEnt;
1425
        $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1426
        $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...
1427
        return ($y + $h);
1428
    } //fim da função destinatarioDANFE
1429
1430
    /**
1431
     * localEntregaDANFE
1432
     * Monta o campo com os dados do local de entrega na DANFE. (retrato e paisagem)
1433
     *
1434
     * @name   localEntregaDANFE
1435
     * @param  number $x Posição horizontal canto esquerdo
1436
     * @param  number $y Posição vertical canto superior
1437
     * @return number Posição vertical final
1438
     */
1439
    protected function localEntregaDANFE($x = 0, $y = 0)
1440
    {
1441
        //####################################################################################
1442
        //LOCAL DE ENTREGA
1443
        $oldX = $x;
1444
        if ($this->orientacao == 'P') {
1445
            $maxW = $this->wPrint;
1446
        } else {
1447
            $maxW = $this->wPrint - $this->wCanhoto;
1448
        }
1449
        $w = $maxW;
1450
        $h = 7;
1451
        $texto = 'INFORMAÇÕES DO LOCAL DE ENTREGA';
1452
        $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1453
        $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...
1454
        //NOME / RAZÃO SOCIAL
1455
        $w = round($maxW*0.61, 0);
1456
        $w1 = $w;
1457
        $y += 3;
1458
        $texto = 'NOME / RAZÃO SOCIAL';
1459
        $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1460
        $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...
1461
        $texto = '';
1462
        if ($this->entrega->getElementsByTagName("xNome")->item(0)) {
1463
            $texto = $this->entrega->getElementsByTagName("xNome")->item(0)->nodeValue;
1464
        }
1465
        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1466
        if ($this->orientacao == 'P') {
1467
            $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...
1468
        } else {
1469
            $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...
1470
        }
1471
        //CNPJ / CPF
1472
        $x += $w;
1473
        $w = round($maxW*0.23, 0);
1474
        $w2 = $w;
1475
        $texto = 'CNPJ / CPF';
1476
        $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1477
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1478
        //Pegando valor do CPF/CNPJ
1479
        if (! empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1480
            $texto = $this->formatField(
1481
                $this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1482
                "###.###.###/####-##"
1483
            );
1484
        } else {
1485
            $texto = ! empty($this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1486
                    $this->formatField(
1487
                        $this->entrega->getElementsByTagName("CPF")->item(0)->nodeValue,
1488
                        "###.###.###-##"
1489
                    ) : '';
1490
        }
1491
        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1492
        $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...
1493
        //INSCRIÇÃO ESTADUAL
1494
        $x += $w;
1495
        $w = $maxW-($w1+$w2);
1496
        $wx = $w;
1497
        $texto = 'INSCRIÇÃO ESTADUAL';
1498
        $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1499
        $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...
1500
        $texto = '';
1501
        if ($this->entrega->getElementsByTagName("IE")->item(0)) {
1502
            $texto = $this->entrega->getElementsByTagName("IE")->item(0)->nodeValue;
1503
        }
1504
        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1505
        if ($this->orientacao == 'P') {
1506
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1507
        } else {
1508
            $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...
1509
        }
1510
        //ENDEREÇO
1511
        $w = round($maxW*0.355, 0) + $wx;
1512
        $w1 = $w;
1513
        $y += $h;
1514
        $x = $oldX;
1515
        $texto = 'ENDEREÇO';
1516
        $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1517
        $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...
1518
        $texto = $this->entrega->getElementsByTagName("xLgr")->item(0)->nodeValue;
1519
        $texto .= ', ' . $this->entrega->getElementsByTagName("nro")->item(0)->nodeValue;
1520
        $texto .= $this->getTagValue($this->entrega, "xCpl", " - ");
1521
        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1522
        $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...
1523
        //BAIRRO / DISTRITO
1524
        $x += $w;
1525
        $w = round($maxW*0.335, 0);
1526
        $w2 = $w;
1527
        $texto = 'BAIRRO / DISTRITO';
1528
        $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1529
        $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...
1530
        $texto = $this->entrega->getElementsByTagName("xBairro")->item(0)->nodeValue;
1531
        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1532
        $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...
1533
        //CEP
1534
        $x += $w;
1535
        $w = $maxW-($w1+$w2);
1536
        $texto = 'CEP';
1537
        $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1538
        $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...
1539
        $texto = ! empty($this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1540
                $this->entrega->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1541
        $texto = $this->formatField($texto, "#####-###");
1542
        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1543
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1544
        //MUNICÍPIO
1545
        $w = round($maxW*0.805, 0);
1546
        $w1 = $w;
1547
        $y += $h;
1548
        $x = $oldX;
1549
        $texto = 'MUNICÍPIO';
1550
        $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1551
        $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...
1552
        $texto = $this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue;
1553
        if (strtoupper(trim($texto)) == "EXTERIOR" && $this->entrega->getElementsByTagName("xPais")->length > 0) {
1554
            $texto .= " - " .  $this->entrega->getElementsByTagName("xPais")->item(0)->nodeValue;
1555
        }
1556
        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1557
        $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...
1558
        //UF
1559
        $x += $w;
1560
        $w = 8;
1561
        $texto = 'UF';
1562
        $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1563
        $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...
1564
        $texto = $this->entrega->getElementsByTagName("UF")->item(0)->nodeValue;
1565
        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1566
        $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...
1567
        //FONE / FAX
1568
        $x += $w;
1569
        $w = $maxW-$w-$w1;
1570
        $texto = 'FONE / FAX';
1571
        $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1572
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1573
        $texto = ! empty($this->entrega->getElementsByTagName("fone")->item(0)->nodeValue) ?
1574
                $this->entrega->getElementsByTagName("fone")->item(0)->nodeValue : '';
1575
        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1576
        $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...
1577
        return ($y + $h);
1578
    } //fim da função localEntregaDANFE
1579
    
1580
    /**
1581
     * localretiradaDANFE
1582
     * Monta o campo com os dados do local de entrega na DANFE. (retrato e paisagem)
1583
     *
1584
     * @name   localretiradaDANFE
1585
     * @param  number $x Posição horizontal canto esquerdo
1586
     * @param  number $y Posição vertical canto superior
1587
     * @return number Posição vertical final
1588
     */
1589
    protected function localRetiradaDANFE($x = 0, $y = 0)
1590
    {
1591
        //####################################################################################
1592
        //LOCAL DE RETIRADA
1593
        $oldX = $x;
1594
        if ($this->orientacao == 'P') {
1595
            $maxW = $this->wPrint;
1596
        } else {
1597
            $maxW = $this->wPrint - $this->wCanhoto;
1598
        }
1599
        $w = $maxW;
1600
        $h = 7;
1601
        $texto = 'INFORMAÇÕES DO LOCAL DE RETIRADA';
1602
        $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1603
        $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...
1604
        //NOME / RAZÃO SOCIAL
1605
        $w = round($maxW*0.61, 0);
1606
        $w1 = $w;
1607
        $y += 3;
1608
        $texto = 'NOME / RAZÃO SOCIAL';
1609
        $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1610
        $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...
1611
        $texto = '';
1612
        if ($this->retirada->getElementsByTagName("xNome")->item(0)) {
1613
            $texto = $this->retirada->getElementsByTagName("xNome")->item(0)->nodeValue;
1614
        }
1615
        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1616
        if ($this->orientacao == 'P') {
1617
            $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...
1618
        } else {
1619
            $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...
1620
        }
1621
        //CNPJ / CPF
1622
        $x += $w;
1623
        $w = round($maxW*0.23, 0);
1624
        $w2 = $w;
1625
        $texto = 'CNPJ / CPF';
1626
        $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1627
        $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...
1628
        //Pegando valor do CPF/CNPJ
1629
        if (! empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1630
            $texto = $this->formatField(
1631
                $this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1632
                "###.###.###/####-##"
1633
            );
1634
        } else {
1635
            $texto = ! empty($this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1636
                    $this->formatField(
1637
                        $this->retirada->getElementsByTagName("CPF")->item(0)->nodeValue,
1638
                        "###.###.###-##"
1639
                    ) : '';
1640
        }
1641
        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1642
        $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...
1643
        //INSCRIÇÃO ESTADUAL
1644
        $x += $w;
1645
        $w = $maxW-($w1+$w2);
1646
        $wx = $w;
1647
        $texto = 'INSCRIÇÃO ESTADUAL';
1648
        $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1649
        $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...
1650
        $texto = '';
1651
        if ($this->retirada->getElementsByTagName("IE")->item(0)) {
1652
            $texto = $this->retirada->getElementsByTagName("IE")->item(0)->nodeValue;
1653
        }
1654
        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1655
        if ($this->orientacao == 'P') {
1656
            $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...
1657
        } else {
1658
            $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...
1659
        }
1660
        //ENDEREÇO
1661
        $w = round($maxW*0.355, 0) + $wx;
1662
        $w1 = $w;
1663
        $y += $h;
1664
        $x = $oldX;
1665
        $texto = 'ENDEREÇO';
1666
        $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1667
        $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
0 ignored issues
show
Documentation introduced by
1 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1668
        $texto = $this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue;
1669
        $texto .= ', ' . $this->retirada->getElementsByTagName("nro")->item(0)->nodeValue;
1670
        $texto .= $this->getTagValue($this->retirada, "xCpl", " - ");
1671
        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1672
        $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...
1673
        //BAIRRO / DISTRITO
1674
        $x += $w;
1675
        $w = round($maxW*0.335, 0);
1676
        $w2 = $w;
1677
        $texto = 'BAIRRO / DISTRITO';
1678
        $aFont = array('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
        $texto = $this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue;
1681
        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1682
        $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...
1683
        //CEP
1684
        $x += $w;
1685
        $w = $maxW-($w1+$w2);
1686
        $texto = 'CEP';
1687
        $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1688
        $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...
1689
        $texto = ! empty($this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1690
                $this->retirada->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1691
        $texto = $this->formatField($texto, "#####-###");
1692
        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1693
        $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...
1694
        //MUNICÍPIO
1695
        $w = round($maxW*0.805, 0);
1696
        $w1 = $w;
1697
        $y += $h;
1698
        $x = $oldX;
1699
        $texto = 'MUNICÍPIO';
1700
        $aFont = array('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 = $this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue;
1703
        if (strtoupper(trim($texto)) == "EXTERIOR" && $this->retirada->getElementsByTagName("xPais")->length > 0) {
1704
            $texto .= " - " .  $this->retirada->getElementsByTagName("xPais")->item(0)->nodeValue;
1705
        }
1706
        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1707
        $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...
1708
        //UF
1709
        $x += $w;
1710
        $w = 8;
1711
        $texto = 'UF';
1712
        $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1713
        $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...
1714
        $texto = $this->retirada->getElementsByTagName("UF")->item(0)->nodeValue;
1715
        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1716
        $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...
1717
        //FONE / FAX
1718
        $x += $w;
1719
        $w = $maxW-$w-$w1;
1720
        $texto = 'FONE / FAX';
1721
        $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1722
        $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...
1723
        $texto = ! empty($this->retirada->getElementsByTagName("fone")->item(0)->nodeValue) ?
1724
                $this->retirada->getElementsByTagName("fone")->item(0)->nodeValue : '';
1725
        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1726
        $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...
1727
        return ($y + $h);
1728
    } //fim da função localRetiradaDANFE
1729
    
1730
     /**
1731
     * getTextoFatura
1732
     * Gera a String do Texto da Fatura
1733
      *
1734
     * @name   getTextoFatura
1735
     * @return uma String com o texto ou "";
1736
     */
1737
    protected function getTextoFatura()
1738
    {
1739
        if (isset($this->cobr)) {
1740
            $fat = $this->cobr->getElementsByTagName("fat")->item(0);
1741
            if (isset($fat)) {
1742
                if (!empty($this->getTagValue($this->ide, "indPag"))) {
1743
                    $textoIndPag = "";
1744
                    $indPag = $this->getTagValue($this->ide, "indPag");
1745
                    if ($indPag === "0") {
1746
                        $textoIndPag = "Pagamento à Vista - ";
1747
                    } elseif ($indPag === "1") {
1748
                        $textoIndPag = "Pagamento à Prazo - ";
1749
                    }
1750
                    $nFat = $this->getTagValue($fat, "nFat", "Fatura: ");
1751
                    $vOrig = $this->getTagValue($fat, "vOrig", " Valor Original: ");
1752
                    $vDesc = $this->getTagValue($fat, "vDesc", " Desconto: ");
1753
                    $vLiq = $this->getTagValue($fat, "vLiq", " Valor Líquido: ");
1754
                    $texto = $textoIndPag . $nFat . $vOrig . $vDesc . $vLiq;
1755
                    return $texto;
1756
                } else {
1757
                    $pag = $this->dom->getElementsByTagName("pag");
1758
                    if ($tPag = $this->getTagValue($pag->item(0), "tPag")) {
1759
                        return $this->tipoPag($tPag);
1760
                    }
1761
                }
1762
            }
1763
        }
1764
        return "";
1765
    }
1766
1767
     /**
1768
     * sizeExtraTextoFatura
1769
     * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata.
1770
      *
1771
     * @name   sizeExtraTextoFatura
1772
     * @return integer
1773
     */
1774
    protected function sizeExtraTextoFatura()
1775
    {
1776
        $textoFatura = $this->getTextoFatura();
1777
        //verificar se existem duplicatas
1778
        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...
1779
            return 10;
1780
        }
1781
        return 0;
1782
    }
1783
1784
    /**
1785
     * fatura
1786
     * Monta o campo de duplicatas da DANFE (retrato e paisagem)
1787
     *
1788
     * @name   fatura
1789
     * @param  number $x Posição horizontal canto esquerdo
1790
     * @param  number $y Posição vertical canto superior
1791
     * @return number Posição vertical final
1792
     */
1793
    protected function fatura($x, $y)
1794
    {
1795
        $linha = 1;
1796
        $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...
1797
        $oldx = $x;
1798
        $textoFatura = $this->getTextoFatura();
1799
        //verificar se existem duplicatas
1800
        if ($this->dup->length > 0 || $textoFatura !== "") {
1801
            //#####################################################################
1802
            //FATURA / DUPLICATA
1803
            $texto = $y . " - FATURA / DUPLICATA";
1804
            if ($this->orientacao == 'P') {
1805
                $w = $this->wPrint;
1806
            } else {
1807
                $w = 271;
1808
            }
1809
            $h = 8;
1810
            $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1811
            $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...
1812
            $y += 3;
1813
            $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...
1814
            $dupcont = 0;
1815
            $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...
1816
            if ($nFat > 7) {
1817
                $myH = 6;
1818
                $myW = $this->wPrint;
1819
                if ($this->orientacao == 'L') {
1820
                    $myW -= $this->wCanhoto;
1821
                }
1822
                $aFont = ['font' => $this->fontePadrao, 'size' => 9, 'style' => ''];
1823
                $texto = "Existem mais de 7 duplicatas registradas, portanto não "
1824
                    . "serão exibidas, confira diretamente pelo XML.";
1825
                $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...
1826
                return ($y + $h - 3);
1827
            }
1828
            if ($textoFatura !== "" && $this->exibirTextoFatura) {
1829
                $myH=6;
1830
                $myW = $this->wPrint;
1831
                if ($this->orientacao == 'L') {
1832
                    $myW -= $this->wCanhoto;
1833
                }
1834
                $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1835
                $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...
1836
                $y+=$myH+1;
1837
            }
1838
            if ($this->orientacao == 'P') {
1839
                $w = round($this->wPrint/7.018, 0)-1;
1840
            } else {
1841
                $w = 28;
1842
            }
1843
            $increm = 1;
1844
            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...
1845
                $nDup = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue)
1846
                ? $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue
1847
                : '';
1848
                $dDup = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
1849
                ? $this->ymdTodmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue)
1850
                : '';
1851
                $vDup = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue)
1852
                ? 'R$ ' . number_format(
1853
                    $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
1854
                    2,
1855
                    ",",
1856
                    "."
1857
                )
1858
                : '';
1859
                $h = 8;
1860
                $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...
1861
                if ($nDup!='0' && $nDup!='') {
1862
                    $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1863
                    $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...
1864
                    $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1865
                    $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...
1866
                } else {
1867
                    $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1868
                    $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...
1869
                }
1870
                $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1871
                $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...
1872
                $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1873
                $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...
1874
                $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1875
                $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...
1876
                $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1877
                $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...
1878
                $x += $w+$increm;
1879
                $dupcont += 1;
1880
                if ($this->orientacao == 'P') {
1881
                    $maxDupCont = 6;
1882
                } else {
1883
                    $maxDupCont = 8;
1884
                }
1885
                if ($dupcont > $maxDupCont) {
1886
                    $y += 9;
1887
                    $x = $oldx;
1888
                    $dupcont = 0;
1889
                    $linha += 1;
1890
                }
1891
                if ($linha == 5) {
1892
                    $linha = 4;
1893
                    break;
1894
                }
1895
            }
1896
            if ($dupcont == 0) {
1897
                $y -= 9;
1898
                $linha--;
1899
            }
1900
            return ($y+$h);
1901
        } else {
1902
            $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...
1903
            return ($y-2);
1904
        }
1905
    }
1906
1907
    /**
1908
     * pagamento
1909
     * Monta o campo de pagamentos da DANFE (retrato e paisagem) (foi baseada na fatura)
1910
     *
1911
     * @name   pagamento
1912
     * @param  number $x Posição horizontal canto esquerdo
1913
     * @param  number $y Posição vertical canto superior
1914
     * @return number Posição vertical final
1915
     */
1916
    protected function pagamento($x, $y)
1917
    {
1918
        $linha = 1;
1919
        $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...
1920
        $oldx = $x;
1921
        //verificar se existem cobranças definidas
1922
        if (isset($this->detPag) && $this->detPag->length > 0) {
1923
            //#####################################################################
1924
            //Tipo de pagamento
1925
            $texto =  "PAGAMENTO";
1926
            if ($this->orientacao == 'P') {
1927
                $w = $this->wPrint;
1928
            } else {
1929
                $w = 271;
1930
            }
1931
            $h = 8;
1932
            $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1933
            $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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

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

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

function acceptsInteger($int) { }

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

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1934
            $y += 3;
1935
            $dups = "";
0 ignored issues
show
Unused Code introduced by
$dups is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

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