Completed
Push — master ( 857689...68fe75 )
by Roberto
14s
created

Make::montaCTe()   F

Complexity

Conditions 31
Paths > 20000

Size

Total Lines 119
Code Lines 85

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 992

Importance

Changes 0
Metric Value
dl 0
loc 119
ccs 0
cts 108
cp 0
rs 2
c 0
b 0
f 0
cc 31
eloc 85
nc 23041
nop 0
crap 992

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace NFePHP\CTe;
4
5
/**
6
 *
7
 * @category  Library
8
 * @package   nfephp-org/sped-cte
9
 * @copyright 2009-2016 NFePHP
10
 * @name      Make.php
11
 * @license   http://www.gnu.org/licenses/gpl.html GNU/GPL v.3
12
 * @link      http://github.com/nfephp-org/sped-cte for the canonical source repository
13
 * @author    Roberto L. Machado <linux.rlm at gmail dot com>
14
 */
15
16
use DOMElement;
17
use NFePHP\Common\Base\BaseMake;
18
19
class Make extends BaseMake
20
{
21
    /**
22
     * versao
23
     * numero da versão do xml da CTe
24
     * @var string
25
     */
26
    public $versao = '3.00';
27
    /**
28
     * mod
29
     * modelo da CTe 57
30
     * @var integer
31
     */
32
    public $mod = 57;
33
    /**
34
     * chave da MDFe
35
     * @var string
36
     */
37
    public $chCTe = '';
38
    /**
39
     * xml
40
     * String com o xml do documento fiscal montado
41
     * @var string
42
     */
43
    public $xml = '';
44
    /**
45
     * dom
46
     * Variável onde será montado o xml do documento fiscal
47
     * @var \NFePHP\Common\Dom\Dom
48
     */
49
    public $dom;
50
    /**
51
     * tpAmb
52
     * tipo de ambiente
53
     * @var string
54
     */
55
    public $tpAmb = '2';
56
    /**
57
     * Modal do Cte
58
     * @var integer
59
     */
60
    private $modal = 0;
61
    /**
62
     * Tag CTe
63
     * @var \DOMNode
64
     */
65
    private $CTe = '';
66
    /**
67
     * Informações do CT-e
68
     * @var \DOMNode
69
     */
70
    private $infCte = '';
71
    /**
72
     * Identificação do CT-e
73
     * @var \DOMNode
74
     */
75
    private $ide = '';
76
    /**
77
     * Tipo do Serviço
78
     * @var integer
79
     */
80
    private $tpServ = 0;
81
    /**
82
     * Indicador do "papel" do tomador do serviço no CT-e
83
     * @var \DOMNode
84
     */
85
    private $toma3 = '';
86
    /**
87
     * Indicador do "papel" do tomador do serviço no CT-e
88
     * @var \DOMNode
89
     */
90
    private $toma4 = '';
91
    /**
92
     * Dados do endereço
93
     * @var \DOMNode
94
     */
95
    private $enderToma = '';
96
    /**
97
     * Dados complementares do CT-e para fins operacionais ou comerciais
98
     * @var \DOMNode
99
     */
100
    private $compl = '';
101
    /**
102
     * Previsão do fluxo da carga
103
     * @var \DOMNode
104
     */
105
    private $fluxo = '';
106
    /**
107
     * Passagem
108
     * @var array
109
     */
110
    private $pass = array();
111
    /**
112
     * Informações ref. a previsão de entrega
113
     * @var \DOMNode
114
     */
115
    private $entrega = '';
116
    /**
117
     * Entrega sem data definida
118
     * @var \DOMNode
119
     */
120
    private $semData = '';
121
    /**
122
     * Entrega com data definida
123
     * @var \DOMNode
124
     */
125
    private $comData = '';
126
    /**
127
     * Entrega no período definido
128
     * @var \DOMNode
129
     */
130
    private $noPeriodo = '';
131
    /**
132
     * Entrega sem hora definida
133
     * @var \DOMNode
134
     */
135
    private $semHora = '';
136
    /**
137
     * Entrega com hora definida
138
     * @var \DOMNode
139
     */
140
    private $comHora = '';
141
    /**
142
     * Entrega no intervalo de horário definido
143
     * @var \DOMNode
144
     */
145
    private $noInter = '';
146
    /**
147
     * Campo de uso livre do contribuinte
148
     * @var array
149
     */
150
    private $obsCont = array();
151
    /**
152
     * Campo de uso livre do contribuinte
153
     * @var array
154
     */
155
    private $obsFisco = array();
156
    /**
157
     * Identificação do Emitente do CT-e
158
     * @var \DOMNode
159
     */
160
    private $emit = '';
161
    /**
162
     * Endereço do emitente
163
     * @var \DOMNode
164
     */
165
    private $enderEmit = '';
166
    /**
167
     * Informações do Remetente das mercadorias transportadas pelo CT-e
168
     * @var \DOMNode
169
     */
170
    private $rem = '';
171
    /**
172
     * Dados do endereço
173
     * @var \DOMNode
174
     */
175
    private $enderReme = '';
176
    /**
177
     * Informações do Expedidor da Carga
178
     * @var \DOMNode
179
     */
180
    private $exped = '';
181
    /**
182
     * Dados do endereço
183
     * @var \DOMNode
184
     */
185
    private $enderExped = '';
186
    /**
187
     * Informações do Recebedor da Carga
188
     * @var \DOMNode
189
     */
190
    private $receb = '';
191
    /**
192
     * Dados do endereço
193
     * @var \DOMNode
194
     */
195
    private $enderReceb = '';
196
    /**
197
     * Informações do Destinatário do CT-e
198
     * @var \DOMNode
199
     */
200
    private $dest = '';
201
    /**
202
     * Dados do endereço
203
     * @var \DOMNode
204
     */
205
    private $enderDest = '';
206
    /**
207
     * Valores da Prestação de Serviço
208
     * @var \DOMNode
209
     */
210
    private $vPrest = '';
211
    /**
212
     * Componentes do Valor da Prestação
213
     * @var array
214
     */
215
    private $comp = array();
216
    /**
217
     * Informações relativas aos Impostos
218
     * @var \DOMNode
219
     */
220
    private $imp = '';
221
    /**
222
     * Informações relativas ao ICMS
223
     * @var \DOMNode
224
     */
225
    private $ICMS = '';
0 ignored issues
show
Unused Code introduced by
The property $ICMS is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
226
    /**
227
     * Prestação sujeito à tributação normal do ICMS
228
     * @var \DOMNode
229
     */
230
    private $ICMS00 = '';
0 ignored issues
show
Unused Code introduced by
The property $ICMS00 is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
231
    /**
232
     * Prestação sujeito à tributação com redução de BC do ICMS
233
     * @var \DOMNode
234
     */
235
    private $ICMS20 = '';
0 ignored issues
show
Unused Code introduced by
The property $ICMS20 is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
236
    /**
237
     * ICMS Isento, não Tributado ou diferido
238
     * @var \DOMNode
239
     */
240
    private $ICMS45 = '';
0 ignored issues
show
Unused Code introduced by
The property $ICMS45 is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
241
    /**
242
     * Tributação pelo ICMS60 - ICMS cobrado por substituição tributária.
243
     * Responsabilidade do recolhimento do ICMS atribuído ao tomador ou 3º por ST
244
     * @var \DOMNode
245
     */
246
    private $ICMS60 = '';
0 ignored issues
show
Unused Code introduced by
The property $ICMS60 is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
247
    /**
248
     * ICMS Outros
249
     * @var \DOMNode
250
     */
251
    private $ICMS90 = '';
0 ignored issues
show
Unused Code introduced by
The property $ICMS90 is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
252
    /**
253
     * ICMS devido à UF de origem da prestação, quando diferente da UF do emitente
254
     * @var \DOMNode
255
     */
256
    private $ICMSOutraUF = '';
0 ignored issues
show
Unused Code introduced by
The property $ICMSOutraUF is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
257
    /**
258
     * Simples Nacional
259
     * @var \DOMNode
260
     */
261
    private $ICMSSN = '';
0 ignored issues
show
Unused Code introduced by
The property $ICMSSN is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
262
    /**
263
     * Observações adicionais da CT-e
264
     * @var string
265
     */
266
    private $xObs = '';
0 ignored issues
show
Unused Code introduced by
The property $xObs is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
267
    /**
268
     * Grupo de informações do CT-e Normal e Substituto
269
     * @var \DOMNode
270
     */
271
    private $infCTeNorm = '';
272
    /**
273
     * Informações da Carga do CT-e
274
     * @var \DOMNode
275
     */
276
    private $infCarga = '';
277
    /**
278
     * Informações de quantidades da Carga do CT-e
279
     * @var \DOMNode
280
     */
281
    private $infQ = array();
282
    /**
283
     * Informações dos documentos transportados pelo CT-e Opcional para Redespacho Intermediario
284
     * e Serviço vinculado a multimodal.
285
     * @var \DOMNode
286
     */
287
    private $infDoc = array();
288
    /**
289
     * Informações das NF
290
     * @var array
291
     */
292
    private $infNF = array();
293
    /**
294
     * Informações das NF-e
295
     * @var array
296
     */
297
    private $infNFe = array();
298
    /**
299
     * Informações dos demais documentos
300
     * @var array
301
     */
302
    private $infOutros = array();
303
    /**
304
     * Informações das Unidades de Transporte (Carreta/Reboque/Vagão)
305
     * @var array
306
     */
307
    private $infUnidTransp = array();
0 ignored issues
show
Unused Code introduced by
The property $infUnidTransp is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
308
    /**
309
     * Lacres das Unidades de Transporte
310
     * @var array
311
     */
312
    private $lacUnidTransp = array();
0 ignored issues
show
Unused Code introduced by
The property $lacUnidTransp is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
313
    /**
314
     * Informações das Unidades de Carga (Containeres/ULD/Outros)
315
     * @var array
316
     */
317
    private $infUnidCarga = array();
0 ignored issues
show
Unused Code introduced by
The property $infUnidCarga is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
318
    /**
319
     * Lacres das Unidades de Carga
320
     * @var array
321
     */
322
    private $lacUnidCarga = array();
0 ignored issues
show
Unused Code introduced by
The property $lacUnidCarga is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
323
    /**
324
     * Documentos de Transporte Anterior
325
     * @var \DOMNode
326
     */
327
    private $docAnt = array();
328
    /**
329
     * Emissor do documento anterior
330
     * @var array
331
     */
332
    private $emiDocAnt = array();
333
    /**
334
     * Informações de identificação dos documentos de Transporte Anterior
335
     * @var array
336
     */
337
    private $idDocAnt = array();
338
    /**
339
     * Documentos de transporte anterior em papel
340
     * @var array
341
     */
342
    private $idDocAntPap = array();
0 ignored issues
show
Unused Code introduced by
The property $idDocAntPap is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
343
    /**
344
     * Documentos de transporte anterior eletrônicos
345
     * @var array
346
     */
347
    private $idDocAntEle = array();
348
    /**
349
     * Informações de Seguro da Carga
350
     * @var array
351
     */
352
    private $seg = array();
353
    /**
354
     * Informações do modal
355
     * @var \DOMNode
356
     */
357
    private $infModal = '';
358
    /**
359
     * Preenchido quando for transporte de produtos classificados pela ONU como perigosos.
360
     * @var array
361
     */
362
    private $peri = array();
0 ignored issues
show
Unused Code introduced by
The property $peri is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
363
    /**
364
     * informações dos veículos transportados
365
     * @var array
366
     */
367
    private $veicNovos = array();
0 ignored issues
show
Unused Code introduced by
The property $veicNovos is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
368
    /**
369
     * Dados da cobrança do CT-e
370
     * @var \DOMNode
371
     */
372
    private $cobr = '';
0 ignored issues
show
Unused Code introduced by
The property $cobr is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
373
    /**
374
     * Dados da fatura
375
     * @var \DOMNode
376
     */
377
    private $fat = '';
0 ignored issues
show
Unused Code introduced by
The property $fat is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
378
    /**
379
     * Dados das duplicatas
380
     * @var array
381
     */
382
    private $dup = array();
0 ignored issues
show
Unused Code introduced by
The property $dup is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
383
    /**
384
     * Informações do CT-e de substituição
385
     * @var \DOMNode
386
     */
387
    private $infCteSub = '';
0 ignored issues
show
Unused Code introduced by
The property $infCteSub is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
388
    /**
389
     * Tomador é contribuinte do ICMS
390
     * @var \DOMNode
391
     */
392
    private $tomaICMS = '';
0 ignored issues
show
Unused Code introduced by
The property $tomaICMS is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
393
    /**
394
     * Tomador não é contribuinte do ICMS
395
     * @var \DOMNode
396
     */
397
    private $tomaNaoICMS = '';
0 ignored issues
show
Unused Code introduced by
The property $tomaNaoICMS is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
398
    /**
399
     * Informação da NF ou CT emitido pelo Tomador
400
     * @var \DOMNode
401
     */
402
    private $refNF = '';
0 ignored issues
show
Unused Code introduced by
The property $refNF is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
403
    /**
404
     * Informação do CTe emitido pelo Tomador
405
     * @var \DOMNode
406
     */
407
    private $refCte = '';
0 ignored issues
show
Unused Code introduced by
The property $refCte is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
408
    /**
409
     * Informação da NF ou CT emitido pelo Tomador
410
     * @var \DOMNode
411
     */
412
    private $infCteComp = '';
413
    /**
414
     * Detalhamento do CT-e do tipo Anulação
415
     * @var \DOMNode
416
     */
417
    private $infCteAnu = '';
418
    /**
419
     * Informações do modal Rodoviário
420
     * @var \DOMNode
421
     */
422
    private $rodo = '';
423
    /**
424
     * Ordens de Coleta associados
425
     * @var array
426
     */
427
    private $occ = array();
0 ignored issues
show
Unused Code introduced by
The property $occ is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
428
    /**
429
     * @var \DOMNode
430
     */
431
    private $emiOcc = array();
0 ignored issues
show
Unused Code introduced by
The property $emiOcc is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
432
    /**
433
     * Informações de Vale Pedágio
434
     * @var array
435
     */
436
    private $valePed = array();
0 ignored issues
show
Unused Code introduced by
The property $valePed is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
437
    /**
438
     * Dados dos Veículos
439
     * @var array
440
     */
441
    private $veic = array();
442
    /**
443
     * Proprietários do Veículo. Só preenchido quando o veículo não pertencer à empresa emitente do CT-e
444
     * @var array
445
     */
446
    private $prop = array();
447
    /**
448
     * Dados dos Veículos
449
     * @var array
450
     */
451
    private $lacRodo = array();
0 ignored issues
show
Unused Code introduced by
The property $lacRodo is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
452
    /**
453
     * Informações do(s) Motorista(s)
454
     * @var array
455
     */
456
    private $moto = array();
457
458
    /**
459
     * Monta o arquivo XML usando as tag's já preenchidas
460
     *
461
     * @return bool
462
     */
463
    public function montaCTe()
464
    {
465
        if (count($this->erros) > 0) {
466
            return false;
467
        }
468
        $this->zCTeTag();
469
        if ($this->toma3 != '') {
470
            $this->dom->appChild($this->ide, $this->toma3, 'Falta tag "ide"');
471
        } else {
472
            $this->dom->appChild($this->toma4, $this->enderToma, 'Falta tag "toma4"');
473
            $this->dom->appChild($this->ide, $this->toma4, 'Falta tag "ide"');
474
        }
475
        $this->dom->appChild($this->infCte, $this->ide, 'Falta tag "infCte"');
476
        if ($this->compl != '') {
477
            if ($this->fluxo != '') {
478
                foreach ($this->pass as $pass) {
479
                    $this->dom->appChild($this->fluxo, $pass, 'Falta tag "fluxo"');
480
                }
481
                $this->dom->appChild($this->compl, $this->fluxo, 'Falta tag "infCte"');
482
            }
483
            if ($this->semData != '') {
484
                $this->zEntregaTag();
485
                $this->dom->appChild($this->entrega, $this->semData, 'Falta tag "Entrega"');
486
            } elseif ($this->comData != '') {
487
                $this->zEntregaTag();
488
                $this->dom->appChild($this->entrega, $this->comData, 'Falta tag "Entrega"');
489
            } elseif ($this->noPeriodo != '') {
490
                $this->zEntregaTag();
491
                $this->dom->appChild($this->entrega, $this->noPeriodo, 'Falta tag "Entrega"');
492
            } elseif ($this->semHora != '') {
493
                $this->zEntregaTag();
494
                $this->dom->appChild($this->entrega, $this->semHora, 'Falta tag "Entrega"');
495
            } elseif ($this->comHora != '') {
496
                $this->zEntregaTag();
497
                $this->dom->appChild($this->entrega, $this->comHora, 'Falta tag "Entrega"');
498
            } elseif ($this->noInter != '') {
499
                $this->zEntregaTag();
500
                $this->dom->appChild($this->entrega, $this->noInter, 'Falta tag "Entrega"');
501
            }
502
            foreach ($this->obsCont as $obsCont) {
503
                $this->dom->appChild($this->compl, $obsCont, 'Falta tag "compl"');
504
            }
505
            foreach ($this->obsFisco as $obsFisco) {
506
                $this->dom->appChild($this->compl, $obsFisco, 'Falta tag "compl"');
507
            }
508
            $this->dom->appChild($this->infCte, $this->compl, 'Falta tag "infCte"');
509
        }
510
        $this->dom->appChild($this->emit, $this->enderEmit, 'Falta tag "emit"');
511
        $this->dom->appChild($this->infCte, $this->emit, 'Falta tag "infCte"');
512
        if ($this->rem != '') {
513
            $this->dom->appChild($this->infCte, $this->rem, 'Falta tag "infCte"');
514
        }
515
        if ($this->exped != '') {
516
            $this->dom->appChild($this->infCte, $this->exped, 'Falta tag "infCte"');
517
        }
518
        if ($this->receb != '') {
519
            $this->dom->appChild($this->infCte, $this->receb, 'Falta tag "infCte"');
520
        }
521
        if ($this->dest != '') {
522
            $this->dom->appChild($this->infCte, $this->dest, 'Falta tag "infCte"');
523
        }
524
        foreach ($this->comp as $comp) {
525
            $this->dom->appChild($this->vPrest, $comp, 'Falta tag "vPrest"');
526
        }
527
        $this->dom->appChild($this->infCte, $this->vPrest, 'Falta tag "infCte"');
528
        $this->dom->appChild($this->infCte, $this->imp, 'Falta tag "imp"');
529
        if ($this->infCteComp != '') { // Caso seja um CTe tipo complemento de valores
530
            $this->dom->appChild($this->infCte, $this->infCteComp, 'Falta tag "infCteComp"');
531
        }
532
        if ($this->infCteAnu != '') { // Caso seja um CTe tipo anulação
533
            $this->dom->appChild($this->infCte, $this->infCteAnu, 'Falta tag "infCteAnu"');
534
        }
535
        if ($this->infCTeNorm != '') { // Caso seja um CTe tipo normal
536
            $this->dom->appChild($this->infCte, $this->infCTeNorm, 'Falta tag "infCTeNorm"');
537
            $this->dom->appChild($this->infCTeNorm, $this->infCarga, 'Falta tag "infCarga"');
538
            foreach ($this->infQ as $infQ) {
0 ignored issues
show
Bug introduced by
The expression $this->infQ of type object<DOMNode> is not traversable.
Loading history...
539
                $this->dom->appChild($this->infCarga, $infQ, 'Falta tag "infQ"');
540
            }
541
542
            $this->dom->appChild($this->infCTeNorm, $this->infDoc, 'Falta tag "infDoc"');
543
            foreach ($this->infNF as $infNF) {
544
                $this->dom->appChild($this->infDoc, $infNF, 'Falta tag "infNF"');
545
            }
546
            foreach ($this->infNFe as $infNFe) {
547
                $this->dom->appChild($this->infDoc, $infNFe, 'Falta tag "infNFe"');
548
            }
549
            foreach ($this->infOutros as $infOutros) {
550
                $this->dom->appChild($this->infDoc, $infOutros, 'Falta tag "infOutros"');
551
            }
552
553
            if ($this->idDocAntEle != []) { //Caso tenha CT-es Anteriores viculados
554
                $this->dom->appChild($this->infCTeNorm, $this->docAnt, 'Falta tag "docAnt"');
555
556
                foreach ($this->emiDocAnt as $emiDocAnt) {
557
                    $this->dom->appChild($this->docAnt, $emiDocAnt, 'Falta tag "emiDocAnt"');
558
                    $this->dom->appChild($emiDocAnt, $this->idDocAnt, 'Falta tag "idDocAnt"');
559
560
                    foreach ($this->idDocAntEle as $idDocAntEle) {
561
                        $this->dom->appChild($this->idDocAnt, $idDocAntEle, 'Falta tag "emiDocAnt"');
562
                    }
563
                }
564
            }
565
566
            foreach ($this->seg as $seg) {
567
                $this->dom->appChild($this->infCTeNorm, $seg, 'Falta tag "seg"');
568
            }
569
570
            $this->dom->appChild($this->infCTeNorm, $this->infModal, 'Falta tag "infModal"');
571
            $this->dom->appChild($this->infModal, $this->rodo, 'Falta tag "rodo"');
572
        }
573
        foreach ($this->veic as $veic) {
574
            $this->dom->appChild($this->rodo, $veic, 'Falta tag "veic"');
575
        }
576
577
        $this->dom->appChild($this->CTe, $this->infCte, 'Falta tag "CTe"');
578
        $this->dom->appChild($this->dom, $this->CTe, 'Falta tag "DOMDocument"');
579
        $this->xml = $this->dom->saveXML();
580
        return true;
581
    }
582
583
    /**
584
     * Gera o grupo básico: Informações do CT-e
585
     * #1
586
     * Nível: 0
587
     *
588
     * @param string $chave  Chave do CTe
589
     * @param string $versao Versão do CTe
590
     *
591
     * @return \DOMElement
592
     */
593 3
    public function infCteTag($chave = '', $versao = '')
594
    {
595 3
        $this->infCte = $this->dom->createElement('infCte');
596 3
        $this->infCte->setAttribute('Id', 'CTe' . $chave);
597 3
        $this->infCte->setAttribute('versao', $versao);
598 3
        return $this->infCte;
599
    }
600
601
    /**
602
     * Gera as tags para o elemento: Identificação do CT-e
603
     * #4
604
     * Nível: 1
605
     * Os parâmetros para esta função são todos os elementos da tag "ide" do tipo elemento (Ele = E|CE|A) e nível 2
606
     * @param string $cUF Código da UF do emitente do CT-e
607
     * @param string $cCT Código numérico que compõe a Chave de Acesso
608
     * @param string $CFOP Código Fiscal de Operações e Prestações
609
     * @param string $natOp Natureza da Operação
610
     * @param string $mod Modelo do documento fiscal
611
     * @param string $serie Série do CT-e
612
     * @param string $nCT Número do CT-e
613
     * @param string $dhEmi Data e hora de emissão do CT-e
614
     * @param string $tpImp Formato de impressão do DACTE
615
     * @param string $tpEmis Forma de emissão do CT-e
616
     * @param string $cDV Digito Verificador da chave de acesso do CT-e
617
     * @param string $tpAmb Tipo do Ambiente
618
     * @param string $tpCTe Tipo do CT-e
619
     * @param string $procEmi Identificador do processo de emissão do CT-e
620
     * @param string $verProc Versão do processo de emissão
621
     * @param string $refCTE Chave de acesso do CT-e referenciado
0 ignored issues
show
Bug introduced by
There is no parameter named $refCTE. 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...
622
     * @param string $cMunEnv Código do Município de envio do CT-e (de onde o documento foi transmitido)
623
     * @param string $xMunEnv Nome do Município de envio do CT-e (de onde o documento foi transmitido)
624
     * @param string $UFEnv Sigla da UF de envio do CT-e (de onde o documento foi transmitido)
625
     * @param string $modal Modal
626
     * @param string $tpServ Tipo do Serviço
627
     * @param string $cMunIni Código do Município de início da prestação
628
     * @param string $xMunIni Nome do Município do início da prestação
629
     * @param string $UFIni UF do início da prestação
630
     * @param string $cMunFim Código do Município de término da prestação
631
     * @param string $xMunFim Nome do Município do término da prestação
632
     * @param string $UFFim UF do término da prestação
633
     * @param string $retira Indicador se o Recebedor retira no Aeroporto, Filial, Porto ou Estação de Destino?
634
     * @param string $xDetRetira Detalhes do retira
635
     * @param string $dhCont Data e Hora da entrada em contingência
636
     * @param string $xJust Justificativa da entrada em contingência
637
     * @return DOMElement|\DOMNode
638
     */
639 3
    public function ideTag(
640
        $cUF = '',
641
        $cCT = '',
642
        $CFOP = '',
643
        $natOp = '',
644
        $mod = '',
645
        $serie = '',
646
        $nCT = '',
647
        $dhEmi = '',
648
        $tpImp = '',
649
        $tpEmis = '',
650
        $cDV = '',
651
        $tpAmb = '',
652
        $tpCTe = '',
653
        $procEmi = '',
654
        $verProc = '',
655
        $indGlobalizado = '',
656
        $cMunEnv = '',
657
        $xMunEnv = '',
658
        $UFEnv = '',
659
        $modal = '',
660
        $tpServ = '',
661
        $cMunIni = '',
662
        $xMunIni = '',
663
        $UFIni = '',
664
        $cMunFim = '',
665
        $xMunFim = '',
666
        $UFFim = '',
667
        $retira = '',
668
        $xDetRetira = '',
669
        $indIEToma = '',
670
        $dhCont = '',
671
        $xJust = ''
672
    ) {
673 3
        $this->tpAmb = $tpAmb;
674 3
        $identificador = '#4 <ide> - ';
675 3
        $this->ide = $this->dom->createElement('ide');
676 3
        $this->dom->addChild(
677 3
            $this->ide,
678 3
            'cUF',
679 3
            $cUF,
680 3
            true,
681 1
            $identificador . 'Código da UF do emitente do CT-e'
682 2
        );
683 3
        $this->dom->addChild(
684 3
            $this->ide,
685 3
            'cCT',
686 3
            $cCT,
687 3
            true,
688 1
            $identificador . 'Código numérico que compõe a Chave de Acesso'
689 2
        );
690 3
        $this->dom->addChild(
691 3
            $this->ide,
692 3
            'CFOP',
693 3
            $CFOP,
694 3
            true,
695 1
            $identificador . 'Código Fiscal de Operações e Prestações'
696 2
        );
697 3
        $this->dom->addChild(
698 3
            $this->ide,
699 3
            'natOp',
700 3
            $natOp,
701 3
            true,
702 1
            $identificador . 'Natureza da Operação'
703 2
        );
704 3
        $this->dom->addChild(
705 3
            $this->ide,
706 3
            'mod',
707 3
            $mod,
708 3
            true,
709 1
            $identificador . 'Modelo do documento fiscal'
710 2
        );
711 3
        $this->mod = $mod;
0 ignored issues
show
Documentation Bug introduced by
The property $mod was declared of type integer, but $mod 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...
712 3
        $this->dom->addChild(
713 3
            $this->ide,
714 3
            'serie',
715 3
            $serie,
716 3
            true,
717 1
            $identificador . 'Série do CT-e'
718 2
        );
719 3
        $this->dom->addChild(
720 3
            $this->ide,
721 3
            'nCT',
722 3
            $nCT,
723 3
            true,
724 1
            $identificador . 'Número do CT-e'
725 2
        );
726 3
        $this->dom->addChild(
727 3
            $this->ide,
728 3
            'dhEmi',
729 3
            $dhEmi,
730 3
            true,
731 1
            $identificador . 'Data e hora de emissão do CT-e'
732 2
        );
733 3
        $this->dom->addChild(
734 3
            $this->ide,
735 3
            'tpImp',
736 3
            $tpImp,
737 3
            true,
738 1
            $identificador . 'Formato de impressão do DACTE'
739 2
        );
740 3
        $this->dom->addChild(
741 3
            $this->ide,
742 3
            'tpEmis',
743 3
            $tpEmis,
744 3
            true,
745 1
            $identificador . 'Forma de emissão do CT-e'
746 2
        );
747 3
        $this->dom->addChild(
748 3
            $this->ide,
749 3
            'cDV',
750 3
            $cDV,
751 3
            true,
752 1
            $identificador . 'Digito Verificador da chave de acesso do CT-e'
753 2
        );
754 3
        $this->dom->addChild(
755 3
            $this->ide,
756 3
            'tpAmb',
757 3
            $tpAmb,
758 3
            true,
759 1
            $identificador . 'Tipo do Ambiente'
760 2
        );
761 3
        $this->dom->addChild(
762 3
            $this->ide,
763 3
            'tpCTe',
764 3
            $tpCTe,
765 3
            true,
766 1
            $identificador . 'Tipo do CT-e'
767 2
        );
768 3
        $this->dom->addChild(
769 3
            $this->ide,
770 3
            'procEmi',
771 3
            $procEmi,
772 3
            true,
773 1
            $identificador . 'Identificador do processo de emissão do CT-e'
774 2
        );
775 3
        $this->dom->addChild(
776 3
            $this->ide,
777 3
            'verProc',
778 3
            $verProc,
779 3
            true,
780 1
            $identificador . 'Versão do processo de emissão'
781 2
        );
782 3
        $this->dom->addChild(
783 3
            $this->ide,
784 3
            'indGlobalizado',
785 3
            $indGlobalizado,
786 3
            false,
787 1
            $identificador . 'Indicador de CT-e Globalizado'
788 2
        );
789 3
        $this->dom->addChild(
790 3
            $this->ide,
791 3
            'cMunEnv',
792 3
            $cMunEnv,
793 3
            true,
794 1
            $identificador . 'Código do Município de envio do CT-e (de onde o documento foi transmitido)'
795 2
        );
796 3
        $this->dom->addChild(
797 3
            $this->ide,
798 3
            'xMunEnv',
799 3
            $xMunEnv,
800 3
            true,
801 1
            $identificador . 'Nome do Município de envio do CT-e (de onde o documento foi transmitido)'
802 2
        );
803 3
        $this->dom->addChild(
804 3
            $this->ide,
805 3
            'UFEnv',
806 3
            $UFEnv,
807 3
            true,
808 1
            $identificador . 'Sigla da UF de envio do CT-e (de onde o documento foi transmitido)'
809 2
        );
810 3
        $this->dom->addChild(
811 3
            $this->ide,
812 3
            'modal',
813 3
            $modal,
814 3
            true,
815 1
            $identificador . 'Modal'
816 2
        );
817 3
        $this->modal = $modal;
0 ignored issues
show
Documentation Bug introduced by
The property $modal was declared of type integer, but $modal 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...
818 3
        $this->dom->addChild(
819 3
            $this->ide,
820 3
            'tpServ',
821 3
            $tpServ,
822 3
            true,
823 1
            $identificador . 'Tipo do Serviço'
824 2
        );
825 3
        $this->dom->addChild(
826 3
            $this->ide,
827 3
            'cMunIni',
828 3
            $cMunIni,
829 3
            true,
830 1
            $identificador . 'Nome do Município do início da prestação'
831 2
        );
832 3
        $this->dom->addChild(
833 3
            $this->ide,
834 3
            'xMunIni',
835 3
            $xMunIni,
836 3
            true,
837 1
            $identificador . 'Nome do Município do início da prestação'
838 2
        );
839 3
        $this->dom->addChild(
840 3
            $this->ide,
841 3
            'UFIni',
842 3
            $UFIni,
843 3
            true,
844 1
            $identificador . 'UF do início da prestação'
845 2
        );
846 3
        $this->dom->addChild(
847 3
            $this->ide,
848 3
            'cMunFim',
849 3
            $cMunFim,
850 3
            true,
851 1
            $identificador . 'Código do Município de término da prestação'
852 2
        );
853 3
        $this->dom->addChild(
854 3
            $this->ide,
855 3
            'xMunFim',
856 3
            $xMunFim,
857 3
            true,
858 1
            $identificador . 'Nome do Município do término da prestação'
859 2
        );
860 3
        $this->dom->addChild(
861 3
            $this->ide,
862 3
            'UFFim',
863 3
            $UFFim,
864 3
            true,
865 1
            $identificador . 'UF do término da prestação'
866 2
        );
867 3
        $this->dom->addChild(
868 3
            $this->ide,
869 3
            'retira',
870 3
            $retira,
871 3
            true,
872 1
            $identificador . 'Indicador se o Recebedor retira no Aeroporto, Filial, Porto ou Estação de Destino'
873 2
        );
874 3
        $this->dom->addChild(
875 3
            $this->ide,
876 3
            'xDetRetira',
877 3
            $xDetRetira,
878 3
            false,
879 1
            $identificador . 'Detalhes do retira'
880 2
        );
881 3
        $this->dom->addChild(
882 3
            $this->ide,
883 3
            'indIEToma',
884 3
            $indIEToma,
885 3
            true,
886 1
            $identificador . 'Indicador do papel do tomador na prestação do serviço'
887 2
        );
888 3
        $this->dom->addChild(
889 3
            $this->ide,
890 3
            'dhCont',
891 3
            $dhCont,
892 3
            false,
893 1
            $identificador . 'Data e Hora da entrada em contingência'
894 2
        );
895 3
        $this->dom->addChild(
896 3
            $this->ide,
897 3
            'xJust',
898 3
            $xJust,
899 3
            false,
900 1
            $identificador . 'Justificativa da entrada em contingência'
901 2
        );
902 3
        $this->tpServ = $tpServ;
0 ignored issues
show
Documentation Bug introduced by
The property $tpServ was declared of type integer, but $tpServ 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...
903 3
        return $this->ide;
904
    }
905
906
    /**
907
     * Gera as tags para o elemento: toma3 (Indicador do "papel" do tomador do serviço no CT-e)
908
     * e adiciona ao grupo ide
909
     * #35
910
     * Nível: 2
911
     * Os parâmetros para esta função são todos os elementos da tag "toma3" do
912
     * tipo elemento (Ele = E|CE|A) e nível 3
913
     *
914
     * @param string $toma Tomador do Serviço
915
     *
916
     * @return \DOMElement
917
     */
918 3
    public function toma3Tag($toma = '')
919
    {
920 3
        $identificador = '#35 <toma3> - ';
921 3
        $this->toma3 = $this->dom->createElement('toma3');
922 3
        $this->dom->addChild(
923 3
            $this->toma3,
924 3
            'toma',
925 3
            $toma,
926 3
            true,
927 1
            $identificador . 'Tomador do Serviço'
928 2
        );
929 3
        return $this->toma3;
930
    }
931
932
    /**
933
     * Gera as tags para o elemento: toma4 (Indicador do "papel" do tomador
934
     * do serviço no CT-e) e adiciona ao grupo ide
935
     * #37
936
     * Nível: 2
937
     * Os parâmetros para esta função são todos os elementos da tag "toma4" do
938
     * tipo elemento (Ele = E|CE|A) e nível 3
939
     *
940
     * @param string $toma  Tomador do Serviço
941
     * @param string $CNPJ  Número do CNPJ
942
     * @param string $CPF   Número do CPF
943
     * @param string $IE    Inscrição Estadual
944
     * @param string $xNome Razão Social ou Nome
945
     * @param string $xFant Nome Fantasia
946
     * @param string $fone  Telefone
947
     * @param string $email Endereço de email
948
     *
949
     * @return \DOMElement
950
     */
951 3
    public function toma4Tag(
952
        $toma = '',
953
        $CNPJ = '',
954
        $CPF = '',
955
        $IE = '',
956
        $xNome = '',
957
        $xFant = '',
958
        $fone = '',
959
        $email = ''
960
    ) {
961 3
        $identificador = '#37 <toma4> - ';
962 3
        $this->toma4 = $this->dom->createElement('toma4');
963 3
        $this->dom->addChild(
964 3
            $this->toma4,
965 3
            'toma',
966 3
            $toma,
967 3
            true,
968 1
            $identificador . 'Tomador do Serviço'
969 2
        );
970 3
        if ($CNPJ != '') {
971 3
            $this->dom->addChild(
972 3
                $this->toma4,
973 3
                'CNPJ',
974 3
                $CNPJ,
975 3
                true,
976 1
                $identificador . 'Número do CNPJ'
977 2
            );
978 2
        } elseif ($CPF != '') {
979
            $this->dom->addChild(
980
                $this->toma4,
981
                'CPF',
982
                $CPF,
983
                true,
984
                $identificador . 'Número do CPF'
985
            );
986
        } else {
987
            $this->dom->addChild(
988
                $this->toma4,
989
                'CNPJ',
990
                $CNPJ,
991
                true,
992
                $identificador . 'Número do CNPJ'
993
            );
994
            $this->dom->addChild(
995
                $this->toma4,
996
                'CPF',
997
                $CPF,
998
                true,
999
                $identificador . 'Número do CPF'
1000
            );
1001
        }
1002 3
        $this->dom->addChild(
1003 3
            $this->toma4,
1004 3
            'IE',
1005 3
            $IE,
1006 3
            false,
1007 1
            $identificador . 'Inscrição Estadual'
1008 2
        );
1009 3
        $this->dom->addChild(
1010 3
            $this->toma4,
1011 3
            'xNome',
1012 3
            $xNome,
1013 3
            true,
1014 1
            $identificador . 'Razão Social ou Nome'
1015 2
        );
1016 3
        $this->dom->addChild(
1017 3
            $this->toma4,
1018 3
            'xFant',
1019 3
            $xFant,
1020 3
            false,
1021 1
            $identificador . 'Nome Fantasia'
1022 2
        );
1023 3
        $this->dom->addChild(
1024 3
            $this->toma4,
1025 3
            'fone',
1026 3
            $fone,
1027 3
            false,
1028 1
            $identificador . 'Telefone'
1029 2
        );
1030 3
        $this->dom->addChild(
1031 3
            $this->toma4,
1032 3
            'email',
1033 3
            $email,
1034 3
            false,
1035 1
            $identificador . 'Endereço de email'
1036 2
        );
1037 3
        return $this->toma4;
1038
    }
1039
1040
    /**
1041
     * Gera as tags para o elemento: "enderToma" (Dados do endereço) e adiciona ao grupo "toma4"
1042
     * #45
1043
     * Nível: 3
1044
     * Os parâmetros para esta função são todos os elementos da tag "enderToma"
1045
     * do tipo elemento (Ele = E|CE|A) e nível 4
1046
     *
1047
     * @param string $xLgr    Logradouro
1048
     * @param string $nro     Número
1049
     * @param string $xCpl    Complemento
1050
     * @param string $xBairro Bairro
1051
     * @param string $cMun    Código do município (utilizar a tabela do IBGE)
1052
     * @param string $xMun    Nome do município
1053
     * @param string $CEP     CEP
1054
     * @param string $UF      Sigla da UF
1055
     * @param string $cPais   Código do país
1056
     * @param string $xPais   Nome do país
1057
     *
1058
     * @return \DOMElement
1059
     */
1060 3
    public function enderTomaTag(
1061
        $xLgr = '',
1062
        $nro = '',
1063
        $xCpl = '',
1064
        $xBairro = '',
1065
        $cMun = '',
1066
        $xMun = '',
1067
        $CEP = '',
1068
        $UF = '',
1069
        $cPais = '',
1070
        $xPais = ''
1071
    ) {
1072 3
        $identificador = '#45 <enderToma> - ';
1073 3
        $this->enderToma = $this->dom->createElement('enderToma');
1074 3
        $this->dom->addChild(
1075 3
            $this->enderToma,
1076 3
            'xLgr',
1077 3
            $xLgr,
1078 3
            true,
1079 1
            $identificador . 'Logradouro'
1080 2
        );
1081 3
        $this->dom->addChild(
1082 3
            $this->enderToma,
1083 3
            'nro',
1084 3
            $nro,
1085 3
            true,
1086 1
            $identificador . 'Número'
1087 2
        );
1088 3
        $this->dom->addChild(
1089 3
            $this->enderToma,
1090 3
            'xCpl',
1091 3
            $xCpl,
1092 3
            false,
1093 1
            $identificador . 'Complemento'
1094 2
        );
1095 3
        $this->dom->addChild(
1096 3
            $this->enderToma,
1097 3
            'xBairro',
1098 3
            $xBairro,
1099 3
            true,
1100 1
            $identificador . 'Bairro'
1101 2
        );
1102 3
        $this->dom->addChild(
1103 3
            $this->enderToma,
1104 3
            'cMun',
1105 3
            $cMun,
1106 3
            true,
1107 1
            $identificador . 'Código do município (utilizar a tabela do IBGE)'
1108 2
        );
1109 3
        $this->dom->addChild(
1110 3
            $this->enderToma,
1111 3
            'xMun',
1112 3
            $xMun,
1113 3
            true,
1114 1
            $identificador . 'Nome do município'
1115 2
        );
1116 3
        $this->dom->addChild(
1117 3
            $this->enderToma,
1118 3
            'CEP',
1119 3
            $CEP,
1120 3
            false,
1121 1
            $identificador . 'CEP'
1122 2
        );
1123 3
        $this->dom->addChild(
1124 3
            $this->enderToma,
1125 3
            'UF',
1126 3
            $UF,
1127 3
            true,
1128 1
            $identificador . 'Sigla da UF'
1129 2
        );
1130 3
        $this->dom->addChild(
1131 3
            $this->enderToma,
1132 3
            'cPais',
1133 3
            $cPais,
1134 3
            false,
1135 1
            $identificador . 'Código do país'
1136 2
        );
1137 3
        $this->dom->addChild(
1138 3
            $this->enderToma,
1139 3
            'xPais',
1140 3
            $xPais,
1141 3
            false,
1142 1
            $identificador . 'Nome do país'
1143 2
        );
1144 3
        return $this->enderToma;
1145
    }
1146
1147
    /**
1148
     * Gera as tags para o elemento: "compl" (Dados complementares do CT-e para fins operacionais ou comerciais)
1149
     * #59
1150
     * Nível: 1
1151
     * Os parâmetros para esta função são todos os elementos da tag "compl" do
1152
     * tipo elemento (Ele = E|CE|A) e nível 2
1153
     *
1154
     * @param string $xCaracAd  Característica adicional do transporte
1155
     * @param string $xCaracSer Característica adicional do serviço
1156
     * @param string $xEmi      Funcionário emissor do CTe
1157
     * @param string $origCalc  Município de origem para efeito de cálculo do frete
1158
     * @param string $destCalc  Município de destino para efeito de cálculo do frete
1159
     * @param string $xObs      Observações Gerais
1160
     *
1161
     * @return \DOMElement
1162
     */
1163
    public function complTag($xCaracAd = '', $xCaracSer = '', $xEmi = '', $origCalc = '', $destCalc = '', $xObs = '')
1164
    {
1165
        $identificador = '#59 <compl> - ';
1166
        $this->compl = $this->dom->createElement('compl');
1167
        $this->dom->addChild(
1168
            $this->compl,
1169
            'xCaracAd',
1170
            $xCaracAd,
1171
            false,
1172
            $identificador . 'Característica adicional do transporte'
1173
        );
1174
        $this->dom->addChild(
1175
            $this->compl,
1176
            'xCaracSer',
1177
            $xCaracSer,
1178
            false,
1179
            $identificador . 'Característica adicional do serviço'
1180
        );
1181
        $this->dom->addChild(
1182
            $this->compl,
1183
            'xEmi',
1184
            $xEmi,
1185
            false,
1186
            $identificador . 'Funcionário emissor do CTe'
1187
        );
1188
        $this->dom->addChild(
1189
            $this->compl,
1190
            'origCalc',
1191
            $origCalc,
1192
            false,
1193
            $identificador . 'Município de origem para efeito de cálculo do frete'
1194
        );
1195
        $this->dom->addChild(
1196
            $this->compl,
1197
            'destCalc',
1198
            $destCalc,
1199
            false,
1200
            $identificador . 'Município de destino para efeito de cálculo do frete'
1201
        );
1202
        $this->dom->addChild(
1203
            $this->compl,
1204
            'xObs',
1205
            $xObs,
1206
            false,
1207
            $identificador . 'Observações Gerais'
1208
        );
1209
        return $this->compl;
1210
    }
1211
1212
    /**
1213
     * Gera as tags para o elemento: "fluxo" (Previsão do fluxo da carga)
1214
     * #63
1215
     * Nível: 2
1216
     * Os parâmetros para esta função são todos os elementos da tag "fluxo" do
1217
     * tipo elemento (Ele = E|CE|A) e nível 3
1218
     *
1219
     * @param string $xOrig Sigla ou código interno da Filial/Porto/Estação/ Aeroporto de Origem
1220
     * @param string $xDest Sigla ou código interno da Filial/Porto/Estação/Aeroporto de Destino
1221
     * @param string $xRota Código da Rota de Entrega
1222
     *
1223
     * @return \DOMElement
1224
     */
1225
    public function fluxoTag($xOrig = '', $xDest = '', $xRota = '')
1226
    {
1227
        $identificador = '#63 <fluxo> - ';
1228
        $this->fluxo = $this->dom->createElement('fluxo');
1229
        $this->dom->addChild(
1230
            $this->fluxo,
1231
            'xOrig',
1232
            $xOrig,
1233
            false,
1234
            $identificador . 'Sigla ou código interno da Filial/Porto/Estação/ Aeroporto de Origem'
1235
        );
1236
        $this->dom->addChild(
1237
            $this->fluxo,
1238
            'xDest',
1239
            $xDest,
1240
            false,
1241
            $identificador . 'Sigla ou código interno da Filial/Porto/Estação/Aeroporto de Destino'
1242
        );
1243
        $this->dom->addChild(
1244
            $this->fluxo,
1245
            'xRota',
1246
            $xRota,
1247
            false,
1248
            $identificador . 'Código da Rota de Entrega'
1249
        );
1250
        return $this->fluxo;
1251
    }
1252
1253
    /**
1254
     * Gera as tags para o elemento: "pass"
1255
     * #65
1256
     * Nível: 3
1257
     * Os parâmetros para esta função são todos os elementos da tag "pass" do
1258
     * tipo elemento (Ele = E|CE|A) e nível 4
1259
     *
1260
     * @param string $xPass Sigla ou código interno da Filial/Porto/Estação/Aeroporto de Passagem
1261
     *
1262
     * @return \DOMElement
1263
     */
1264 View Code Duplication
    public function passTag($xPass = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1265
    {
1266
        $identificador = '#65 <pass> - ';
1267
        $this->pass[] = $this->dom->createElement('pass');
1268
        $posicao = (integer) count($this->pass) - 1;
1269
        $this->dom->addChild(
1270
            $this->pass[$posicao],
1271
            'xPass',
1272
            $xPass,
1273
            false,
1274
            $identificador . 'Sigla ou código interno da Filial/Porto/Estação/Aeroporto de Passagem'
1275
        );
1276
        return $this->pass[$posicao];
1277
    }
1278
1279
    /**
1280
     * Gera as tags para o elemento: "semData" (Entrega sem data definida)
1281
     * #70
1282
     * Nível: 3
1283
     * Os parâmetros para esta função são todos os elementos da tag "semData" do
1284
     * tipo elemento (Ele = E|CE|A) e nível 4
1285
     *
1286
     * @param string $tpPer Tipo de data/período programado para entrega
1287
     *
1288
     * @return \DOMElement
1289
     */
1290
    public function semDataTag($tpPer = '')
1291
    {
1292
        $identificador = '#70 <semData> - ';
1293
        $this->semData = $this->dom->createElement('semData');
1294
        $this->dom->addChild(
1295
            $this->semData,
1296
            'tpPer',
1297
            $tpPer,
1298
            true,
1299
            $identificador . 'Tipo de data/período programado para entrega'
1300
        );
1301
        return $this->semData;
1302
    }
1303
1304
    /**
1305
     * Gera as tags para o elemento: "comData" (Entrega com data definida)
1306
     * #72
1307
     * Nível: 3
1308
     * Os parâmetros para esta função são todos os elementos da tag "comData" do
1309
     * tipo elemento (Ele = E|CE|A) e nível 4
1310
     *
1311
     * @param string $tpPer Tipo de data/período programado para entrega
1312
     * @param string $dProg Data programada
1313
     *
1314
     * @return \DOMElement
1315
     */
1316
    public function comDataTag($tpPer = '', $dProg = '')
1317
    {
1318
        $identificador = '#72 <comData> - ';
1319
        $this->comData = $this->dom->createElement('comData');
1320
        $this->dom->addChild(
1321
            $this->comData,
1322
            'tpPer',
1323
            $tpPer,
1324
            true,
1325
            $identificador . 'Tipo de data/período programado para entrega'
1326
        );
1327
        $this->dom->addChild(
1328
            $this->comData,
1329
            'dProg',
1330
            $dProg,
1331
            true,
1332
            $identificador . 'Data programada'
1333
        );
1334
        return $this->comData;
1335
    }
1336
1337
    /**
1338
     * Gera as tags para o elemento: "noPeriodo" (Entrega no período definido)
1339
     * #75
1340
     * Nível: 3
1341
     * Os parâmetros para esta função são todos os elementos da tag "noPeriodo" do tipo
1342
     * elemento (Ele = E|CE|A) e nível 4
1343
     *
1344
     * @param string $tpPer Tipo de data/período programado para entrega
1345
     * @param string $dIni  Data inicial
1346
     * @param string $dFim  Data final
1347
     *
1348
     * @return \DOMElement
1349
     */
1350 View Code Duplication
    public function noPeriodoTag($tpPer = '', $dIni = '', $dFim = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1351
    {
1352
        $identificador = '#75 <noPeriodo> - ';
1353
        $this->noPeriodo = $this->dom->createElement('noPeriodo');
1354
        $this->dom->addChild(
1355
            $this->noPeriodo,
1356
            'tpPer',
1357
            $tpPer,
1358
            true,
1359
            $identificador . 'Tipo de data/período programado para entrega'
1360
        );
1361
        $this->dom->addChild(
1362
            $this->noPeriodo,
1363
            'dIni',
1364
            $dIni,
1365
            true,
1366
            $identificador . 'Data inicial'
1367
        );
1368
        $this->dom->addChild(
1369
            $this->noPeriodo,
1370
            'dFim',
1371
            $dFim,
1372
            true,
1373
            $identificador . 'Data final'
1374
        );
1375
        return $this->noPeriodo;
1376
    }
1377
1378
    /**
1379
     * Gera as tags para o elemento: "semHora" (Entrega sem hora definida)
1380
     * #79
1381
     * Nível: 3
1382
     * Os parâmetros para esta função são todos os elementos da tag "semHora" do
1383
     * tipo elemento (Ele = E|CE|A) e nível 4
1384
     *
1385
     * @param string $tpHor Tipo de hora
1386
     *
1387
     * @return \DOMElement
1388
     */
1389
    public function semHoraTag($tpHor = '')
1390
    {
1391
        $identificador = '#79 <semHora> - ';
1392
        $this->semHora = $this->dom->createElement('semHora');
1393
        $this->dom->addChild(
1394
            $this->semHora,
1395
            'tpHor',
1396
            $tpHor,
1397
            true,
1398
            $identificador . 'Tipo de hora'
1399
        );
1400
        return $this->semHora;
1401
    }
1402
1403
    /**
1404
     * Gera as tags para o elemento: "comHora" (Entrega sem hora definida)
1405
     * # = 81
1406
     * Nível = 3
1407
     * Os parâmetros para esta função são todos os elementos da tag "comHora" do
1408
     * tipo elemento (Ele = E|CE|A) e nível 4
1409
     *
1410
     * @param string $tpHor Tipo de hora
1411
     * @param string $hProg Hora programada
1412
     *
1413
     * @return \DOMElement
1414
     */
1415
    public function comHoraTag($tpHor = '', $hProg = '')
1416
    {
1417
        $identificador = '#81 <comHora> - ';
1418
        $this->comHora = $this->dom->createElement('comHora');
1419
        $this->dom->addChild(
1420
            $this->comHora,
1421
            'tpHor',
1422
            $tpHor,
1423
            true,
1424
            $identificador . 'Tipo de hora'
1425
        );
1426
        $this->dom->addChild(
1427
            $this->comHora,
1428
            'hProg',
1429
            $hProg,
1430
            true,
1431
            $identificador . 'Hora programada'
1432
        );
1433
        return $this->comHora;
1434
    }
1435
1436
    /**
1437
     * Gera as tags para o elemento: "noInter" (Entrega no intervalo de horário definido)
1438
     * #84
1439
     * Nível: 3
1440
     * Os parâmetros para esta função são todos os elementos da tag "noInter" do
1441
     * tipo elemento (Ele = E|CE|A) e nível 4
1442
     *
1443
     * @param string $tpHor Tipo de hora
1444
     * @param string $hIni  Hora inicial
1445
     * @param string $hFim  Hora final
1446
     *
1447
     * @return \DOMElement
1448
     */
1449 View Code Duplication
    public function noInterTag($tpHor = '', $hIni = '', $hFim = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1450
    {
1451
        $identificador = '#84 <noInter> - ';
1452
        $this->noInter = $this->dom->createElement('noInter');
1453
        $this->dom->addChild(
1454
            $this->noInter,
1455
            'tpHor',
1456
            $tpHor,
1457
            true,
1458
            $identificador . 'Tipo de hora'
1459
        );
1460
        $this->dom->addChild(
1461
            $this->noInter,
1462
            'hIni',
1463
            $hIni,
1464
            true,
1465
            $identificador . 'Hora inicial'
1466
        );
1467
        $this->dom->addChild(
1468
            $this->noInter,
1469
            'hFim',
1470
            $hFim,
1471
            true,
1472
            $identificador . 'Hora final'
1473
        );
1474
        return $this->noInter;
1475
    }
1476
1477
    /**
1478
     * Gera as tags para o elemento: "ObsCont" (Campo de uso livre do contribuinte)
1479
     * #91
1480
     * Nível: 2
1481
     * Os parâmetros para esta função são todos os elementos da tag "ObsCont" do
1482
     * tipo elemento (Ele = E|CE|A) e nível 3
1483
     *
1484
     * @param string $xCampo Identificação do campo
1485
     * @param string $xTexto Conteúdo do campo
1486
     *
1487
     * @return boolean
1488
     */
1489 View Code Duplication
    public function obsContTag($xCampo = '', $xTexto = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1490
    {
1491
        $identificador = '#91 <ObsCont> - ';
1492
        $posicao = (integer) count($this->obsCont) - 1;
1493
        if (count($this->obsCont) <= 10) {
1494
            $this->obsCont[] = $this->dom->createElement('ObsCont');
1495
            $this->obsCont[$posicao]->setAttribute('xCampo', $xCampo);
1496
            $this->dom->addChild(
1497
                $this->obsCont[$posicao],
1498
                'xTexto',
1499
                $xTexto,
1500
                true,
1501
                $identificador . 'Conteúdo do campo'
1502
            );
1503
            return true;
1504
        }
1505
        $this->erros[] = array(
1506
            'tag' => (string) '<ObsCont>',
1507
            'desc' => (string) 'Campo de uso livre do contribuinte',
1508
            'erro' => (string) 'Tag deve aparecer de 0 a 10 vezes'
1509
        );
1510
        return false;
1511
    }
1512
1513
    /**
1514
     * Gera as tags para o elemento: "ObsFisco" (Campo de uso livre do contribuinte)
1515
     * #94
1516
     * Nível: 2
1517
     * Os parâmetros para esta função são todos os elementos da tag "ObsFisco" do tipo
1518
     * elemento (Ele = E|CE|A) e nível 3
1519
     *
1520
     * @param string $xCampo Identificação do campo
1521
     * @param string $xTexto Conteúdo do campo
1522
     *
1523
     * @return boolean
1524
     */
1525 View Code Duplication
    public function obsFiscoTag($xCampo = '', $xTexto = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1526
    {
1527
        $identificador = '#94 <ObsFisco> - ';
1528
        $posicao = (integer) count($this->obsFisco) - 1;
1529
        if (count($this->obsFisco) <= 10) {
1530
            $this->obsFisco[] = $this->dom->createElement('obsFisco');
1531
            $this->obsFisco[$posicao]->setAttribute('xCampo', $xCampo);
1532
            $this->dom->addChild(
1533
                $this->obsFisco[$posicao],
1534
                'xTexto',
1535
                $xTexto,
1536
                true,
1537
                $identificador . 'Conteúdo do campo'
1538
            );
1539
            return true;
1540
        }
1541
        $this->erros[] = array(
1542
            'tag' => (string) '<ObsFisco>',
1543
            'desc' => (string) 'Campo de uso livre do contribuinte',
1544
            'erro' => (string) 'Tag deve aparecer de 0 a 10 vezes'
1545
        );
1546
        return false;
1547
    }
1548
1549
    /**
1550
     * Gera as tags para o elemento: "emit" (Identificação do Emitente do CT-e)
1551
     * #97
1552
     * Nível: 1
1553
     * Os parâmetros para esta função são todos os elementos da tag "emit" do
1554
     * tipo elemento (Ele = E|CE|A) e nível 2
1555
     *
1556
     * @param string $CNPJ  CNPJ do emitente
1557
     * @param string $IE    Inscrição Estadual do Emitente
1558
     * @param string $xNome Razão social ou Nome do emitente
1559
     * @param string $xFant Nome fantasia
1560
     *
1561
     * @return \DOMElement
1562
     */
1563 3
    public function emitTag($CNPJ = '', $IE = '', $IEST = '', $xNome = '', $xFant = '')
1564
    {
1565 3
        $identificador = '#97 <emit> - ';
1566 3
        $this->emit = $this->dom->createElement('emit');
1567 3
        $this->dom->addChild(
1568 3
            $this->emit,
1569 3
            'CNPJ',
1570 3
            $CNPJ,
1571 3
            true,
1572 1
            $identificador . 'CNPJ do emitente'
1573 2
        );
1574 3
        $this->dom->addChild(
1575 3
            $this->emit,
1576 3
            'IE',
1577 3
            $IE,
1578 3
            true,
1579 1
            $identificador . 'Inscrição Estadual do Emitente'
1580 2
        );
1581 3
        $this->dom->addChild(
1582 3
            $this->emit,
1583 3
            'IEST',
1584 3
            $IEST,
1585 3
            false,
1586 1
            $identificador . 'Inscrição Estadual do Substituto Tributário'
1587 2
        );
1588 3
        $this->dom->addChild(
1589 3
            $this->emit,
1590 3
            'xNome',
1591 3
            $xNome,
1592 3
            true,
1593 1
            $identificador . 'Razão social ou Nome do emitente'
1594 2
        );
1595 3
        $this->dom->addChild(
1596 3
            $this->emit,
1597 3
            'xFant',
1598 3
            $xFant,
1599 3
            false,
1600 1
            $identificador . 'Nome fantasia'
1601 2
        );
1602 3
        return $this->emit;
1603
    }
1604
1605
    /**
1606
     * Gera as tags para o elemento: "enderEmit" (Endereço do emitente)
1607
     * #102
1608
     * Nível: 2
1609
     * Os parâmetros para esta função são todos os elementos da tag "enderEmit" do
1610
     * tipo elemento (Ele = E|CE|A) e nível 3
1611
     *
1612
     * @param string $xLgr    Logradouro
1613
     * @param string $nro     Número
1614
     * @param string $xCpl    Complemento
1615
     * @param string $xBairro Bairro
1616
     * @param string $cMun    Código do município (utilizar a tabela do IBGE)
1617
     * @param string $xMun    Nome do município
1618
     * @param string $CEP     CEP
1619
     * @param string $UF      Sigla da UF
1620
     * @param string $fone    Telefone
1621
     *
1622
     * @return \DOMElement
1623
     */
1624 3
    public function enderEmitTag(
1625
        $xLgr = '',
1626
        $nro = '',
1627
        $xCpl = '',
1628
        $xBairro = '',
1629
        $cMun = '',
1630
        $xMun = '',
1631
        $CEP = '',
1632
        $UF = '',
1633
        $fone = ''
1634
    ) {
1635 3
        $identificador = '#102 <enderEmit> - ';
1636 3
        $this->enderEmit = $this->dom->createElement('enderEmit');
1637 3
        $this->dom->addChild(
1638 3
            $this->enderEmit,
1639 3
            'xLgr',
1640 3
            $xLgr,
1641 3
            true,
1642 1
            $identificador . 'Logradouro'
1643 2
        );
1644 3
        $this->dom->addChild(
1645 3
            $this->enderEmit,
1646 3
            'nro',
1647 3
            $nro,
1648 3
            true,
1649 1
            $identificador . 'Número'
1650 2
        );
1651 3
        $this->dom->addChild(
1652 3
            $this->enderEmit,
1653 3
            'xCpl',
1654 3
            $xCpl,
1655 3
            false,
1656 1
            $identificador . 'Complemento'
1657 2
        );
1658 3
        $this->dom->addChild(
1659 3
            $this->enderEmit,
1660 3
            'xBairro',
1661 3
            $xBairro,
1662 3
            true,
1663 1
            $identificador . 'Bairro'
1664 2
        );
1665 3
        $this->dom->addChild(
1666 3
            $this->enderEmit,
1667 3
            'cMun',
1668 3
            $cMun,
1669 3
            true,
1670 1
            $identificador . 'Código do município'
1671 2
        );
1672 3
        $this->dom->addChild(
1673 3
            $this->enderEmit,
1674 3
            'xMun',
1675 3
            $xMun,
1676 3
            true,
1677 1
            $identificador . 'Nome do município'
1678 2
        );
1679 3
        $this->dom->addChild(
1680 3
            $this->enderEmit,
1681 3
            'CEP',
1682 3
            $CEP,
1683 3
            false,
1684 1
            $identificador . 'CEP'
1685 2
        );
1686 3
        $this->dom->addChild(
1687 3
            $this->enderEmit,
1688 3
            'UF',
1689 3
            $UF,
1690 3
            true,
1691 1
            $identificador . 'Sigla da UF'
1692 2
        );
1693 3
        $this->dom->addChild(
1694 3
            $this->enderEmit,
1695 3
            'fone',
1696 3
            $fone,
1697 3
            false,
1698 1
            $identificador . 'Telefone'
1699 2
        );
1700 3
        return $this->enderEmit;
1701
    }
1702
1703
    /**
1704
     * Gera as tags para o elemento: "rem" (Informações do Remetente das mercadorias
1705
     * transportadas pelo CT-e)
1706
     * #112
1707
     * Nível = 1
1708
     * Os parâmetros para esta função são todos os elementos da tag "rem" do
1709
     * tipo elemento (Ele = E|CE|A) e nível 2
1710
     *
1711
     * @param string $CNPJ  Número do CNPJ
1712
     * @param string $CPF   Número do CPF
1713
     * @param string $IE    Inscrição Estadual
1714
     * @param string $xNome Razão social ou nome do remetente
1715
     * @param string $xFant Nome fantasia
1716
     * @param string $fone  Telefone
1717
     * @param string $email Endereço de email
1718
     *
1719
     * @return \DOMElement
1720
     */
1721 3 View Code Duplication
    public function remTag($CNPJ = '', $CPF = '', $IE = '', $xNome = '', $xFant = '', $fone = '', $email = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1722
    {
1723 3
        $identificador = '#97 <rem> - ';
1724 3
        $this->rem = $this->dom->createElement('rem');
1725 3
        if ($CNPJ != '') {
1726 3
            $this->dom->addChild(
1727 3
                $this->rem,
1728 3
                'CNPJ',
1729 3
                $CNPJ,
1730 3
                true,
1731 1
                $identificador . 'CNPJ do Remente'
1732 2
            );
1733 2
        } elseif ($CPF != '') {
1734
            $this->dom->addChild(
1735
                $this->rem,
1736
                'CPF',
1737
                $CPF,
1738
                true,
1739
                $identificador . 'CPF do Remente'
1740
            );
1741
        } else {
1742
            $this->dom->addChild(
1743
                $this->rem,
1744
                'CNPJ',
1745
                $CNPJ,
1746
                true,
1747
                $identificador . 'CNPJ do Remente'
1748
            );
1749
            $this->dom->addChild(
1750
                $this->rem,
1751
                'CPF',
1752
                $CPF,
1753
                true,
1754
                $identificador . 'CPF do remente'
1755
            );
1756
        }
1757 3
        $this->dom->addChild(
1758 3
            $this->rem,
1759 3
            'IE',
1760 3
            $IE,
1761 3
            true,
1762 1
            $identificador . 'Inscrição Estadual do remente'
1763 2
        );
1764 3
        $this->dom->addChild(
1765 3
            $this->rem,
1766 3
            'xNome',
1767 3
            $xNome,
1768 3
            true,
1769 1
            $identificador . 'Razão social ou Nome do remente'
1770 2
        );
1771 3
        $this->dom->addChild(
1772 3
            $this->rem,
1773 3
            'xFant',
1774 3
            $xFant,
1775 3
            false,
1776 1
            $identificador . 'Nome fantasia'
1777 2
        );
1778 3
        $this->dom->addChild(
1779 3
            $this->rem,
1780 3
            'fone',
1781 3
            $fone,
1782 3
            false,
1783 1
            $identificador . 'Telefone'
1784 2
        );
1785 3
        $this->dom->addChild(
1786 3
            $this->rem,
1787 3
            'email',
1788 3
            $email,
1789 3
            false,
1790 1
            $identificador . 'Endereço de email'
1791 2
        );
1792 3
        return $this->rem;
1793
    }
1794
1795
    /**
1796
     * Gera as tags para o elemento: "enderReme" (Dados do endereço)
1797
     * #119
1798
     * Nível: 2
1799
     * Os parâmetros para esta função são todos os elementos da tag "enderReme" do
1800
     * tipo elemento (Ele = E|CE|A) e nível 3
1801
     *
1802
     * @param string $xLgr    Logradouro
1803
     * @param string $nro     Número
1804
     * @param string $xCpl    Complemento
1805
     * @param string $xBairro Bairro
1806
     * @param string $cMun    Código do município (utilizar a tabela do IBGE)
1807
     * @param string $xMun    Nome do município
1808
     * @param string $CEP     CEP
1809
     * @param string $UF      Sigla da UF
1810
     * @param string $cPais   Código do país
1811
     * @param string $xPais   Nome do país
1812
     *
1813
     * @return \DOMElement
1814
     */
1815 3 View Code Duplication
    public function enderRemeTag(
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1816
        $xLgr = '',
1817
        $nro = '',
1818
        $xCpl = '',
1819
        $xBairro = '',
1820
        $cMun = '',
1821
        $xMun = '',
1822
        $CEP = '',
1823
        $UF = '',
1824
        $cPais = '',
1825
        $xPais = ''
1826
    ) {
1827 3
        $identificador = '#119 <enderReme> - ';
1828 3
        $this->enderReme = $this->dom->createElement('enderReme');
1829 3
        $this->dom->addChild(
1830 3
            $this->enderReme,
1831 3
            'xLgr',
1832 3
            $xLgr,
1833 3
            true,
1834 1
            $identificador . 'Logradouro'
1835 2
        );
1836 3
        $this->dom->addChild(
1837 3
            $this->enderReme,
1838 3
            'nro',
1839 3
            $nro,
1840 3
            true,
1841 1
            $identificador . 'Número'
1842 2
        );
1843 3
        $this->dom->addChild(
1844 3
            $this->enderReme,
1845 3
            'xCpl',
1846 3
            $xCpl,
1847 3
            false,
1848 1
            $identificador . 'Complemento'
1849 2
        );
1850 3
        $this->dom->addChild(
1851 3
            $this->enderReme,
1852 3
            'xBairro',
1853 3
            $xBairro,
1854 3
            true,
1855 1
            $identificador . 'Bairro'
1856 2
        );
1857 3
        $this->dom->addChild(
1858 3
            $this->enderReme,
1859 3
            'cMun',
1860 3
            $cMun,
1861 3
            true,
1862 1
            $identificador . 'Código do município (utilizar a tabela do IBGE)'
1863 2
        );
1864 3
        $this->dom->addChild(
1865 3
            $this->enderReme,
1866 3
            'xMun',
1867 3
            $xMun,
1868 3
            true,
1869 1
            $identificador . 'Nome do município'
1870 2
        );
1871 3
        $this->dom->addChild(
1872 3
            $this->enderReme,
1873 3
            'CEP',
1874 3
            $CEP,
1875 3
            false,
1876 1
            $identificador . 'CEP'
1877 2
        );
1878 3
        $this->dom->addChild(
1879 3
            $this->enderReme,
1880 3
            'UF',
1881 3
            $UF,
1882 3
            true,
1883 1
            $identificador . 'Sigla da UF'
1884 2
        );
1885 3
        $this->dom->addChild(
1886 3
            $this->enderReme,
1887 3
            'cPais',
1888 3
            $cPais,
1889 3
            false,
1890 1
            $identificador . 'Código do país'
1891 2
        );
1892 3
        $this->dom->addChild(
1893 3
            $this->enderReme,
1894 3
            'xPais',
1895 3
            $xPais,
1896 3
            false,
1897 1
            $identificador . 'Nome do país'
1898 2
        );
1899
1900 3
        $node = $this->rem->getElementsByTagName("email")->item(0);
1901 3
        $this->rem->insertBefore($this->enderReme, $node);
1902 3
        return $this->enderReme;
1903
    }
1904
1905
    /**
1906
     * Gera as tags para o elemento: "exped" (Informações do Expedidor da Carga)
1907
     * #142
1908
     * Nível: 1
1909
     * Os parâmetros para esta função são todos os elementos da tag "exped" do
1910
     * tipo elemento (Ele = E|CE|A) e nível 2
1911
     *
1912
     * @param string $CNPJ Número do CNPJ
1913
     * @param string $CPF Número do CPF
1914
     * @param string $IE Inscrição Estadual
1915
     * @param string $xNome Razão Social ou Nome
1916
     * @param string $fone Telefone
1917
     * @param string $email Endereço de email
1918
     *
1919
     * @return \DOMElement
1920
     */
1921 View Code Duplication
    public function expedTag($CNPJ = '', $CPF = '', $IE = '', $xNome = '', $fone = '', $email = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1922
    {
1923
        $identificador = '#142 <exped> - ';
1924
        $this->exped = $this->dom->createElement('exped');
1925
        if ($CNPJ != '') {
1926
            $this->dom->addChild(
1927
                $this->exped,
1928
                'CNPJ',
1929
                $CNPJ,
1930
                true,
1931
                $identificador . 'Número do CNPJ'
1932
            );
1933
        } elseif ($CPF != '') {
1934
            $this->dom->addChild(
1935
                $this->exped,
1936
                'CPF',
1937
                $CPF,
1938
                true,
1939
                $identificador . 'Número do CPF'
1940
            );
1941
        } else {
1942
            $this->dom->addChild(
1943
                $this->exped,
1944
                'CNPJ',
1945
                $CNPJ,
1946
                true,
1947
                $identificador . 'Número do CNPJ'
1948
            );
1949
            $this->dom->addChild(
1950
                $this->exped,
1951
                'CPF',
1952
                $CPF,
1953
                true,
1954
                $identificador . 'Número do CPF'
1955
            );
1956
        }
1957
        $this->dom->addChild(
1958
            $this->exped,
1959
            'IE',
1960
            $IE,
1961
            true,
1962
            $identificador . 'Inscrição Estadual'
1963
        );
1964
        $this->dom->addChild(
1965
            $this->exped,
1966
            'xNome',
1967
            $xNome,
1968
            true,
1969
            $identificador . 'Razão social ou Nome'
1970
        );
1971
        $this->dom->addChild(
1972
            $this->exped,
1973
            'fone',
1974
            $fone,
1975
            false,
1976
            $identificador . 'Telefone'
1977
        );
1978
        $this->dom->addChild(
1979
            $this->exped,
1980
            'email',
1981
            $email,
1982
            false,
1983
            $identificador . 'Endereço de email'
1984
        );
1985
        return $this->exped;
1986
    }
1987
1988
    /**
1989
     * Gera as tags para o elemento: "enderExped" (Dados do endereço)
1990
     * #148
1991
     * Nível: 2
1992
     * Os parâmetros para esta função são todos os elementos da tag "enderExped" do
1993
     * tipo elemento (Ele = E|CE|A) e nível 3
1994
     *
1995
     * @param string $xLgr Logradouro
1996
     * @param string $nro Número
1997
     * @param string $xCpl Complemento
1998
     * @param string $xBairro Bairro
1999
     * @param string $cMun Código do município (utilizar a tabela do IBGE)
2000
     * @param string $xMun Nome do município
2001
     * @param string $CEP CEP
2002
     * @param string $UF Sigla da UF
2003
     * @param string $cPais Código do país
2004
     * @param string $xPais Nome do país
2005
     *
2006
     * @return \DOMElement
2007
     */
2008 View Code Duplication
    public function enderExpedTag(
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2009
        $xLgr = '',
2010
        $nro = '',
2011
        $xCpl = '',
2012
        $xBairro = '',
2013
        $cMun = '',
2014
        $xMun = '',
2015
        $CEP = '',
2016
        $UF = '',
2017
        $cPais = '',
2018
        $xPais = ''
2019
    ) {
2020
        $identificador = '#148 <enderExped> - ';
2021
        $this->enderExped = $this->dom->createElement('enderExped');
2022
        $this->dom->addChild(
2023
            $this->enderExped,
2024
            'xLgr',
2025
            $xLgr,
2026
            true,
2027
            $identificador . 'Logradouro'
2028
        );
2029
        $this->dom->addChild(
2030
            $this->enderExped,
2031
            'nro',
2032
            $nro,
2033
            true,
2034
            $identificador . 'Número'
2035
        );
2036
        $this->dom->addChild(
2037
            $this->enderExped,
2038
            'xCpl',
2039
            $xCpl,
2040
            false,
2041
            $identificador . 'Complemento'
2042
        );
2043
        $this->dom->addChild(
2044
            $this->enderExped,
2045
            'xBairro',
2046
            $xBairro,
2047
            true,
2048
            $identificador . 'Bairro'
2049
        );
2050
        $this->dom->addChild(
2051
            $this->enderExped,
2052
            'cMun',
2053
            $cMun,
2054
            true,
2055
            $identificador . 'Código do município (utilizar a tabela do IBGE)'
2056
        );
2057
        $this->dom->addChild(
2058
            $this->enderExped,
2059
            'xMun',
2060
            $xMun,
2061
            true,
2062
            $identificador . 'Nome do município'
2063
        );
2064
        $this->dom->addChild(
2065
            $this->enderExped,
2066
            'CEP',
2067
            $CEP,
2068
            false,
2069
            $identificador . 'CEP'
2070
        );
2071
        $this->dom->addChild(
2072
            $this->enderExped,
2073
            'UF',
2074
            $UF,
2075
            true,
2076
            $identificador . 'Sigla da UF'
2077
        );
2078
        $this->dom->addChild(
2079
            $this->enderExped,
2080
            'cPais',
2081
            $cPais,
2082
            false,
2083
            $identificador . 'Código do país'
2084
        );
2085
        $this->dom->addChild(
2086
            $this->enderExped,
2087
            'xPais',
2088
            $xPais,
2089
            false,
2090
            $identificador . 'Nome do país'
2091
        );
2092
        $node = $this->exped->getElementsByTagName("email")->item(0);
2093
        $this->exped->insertBefore($this->enderExped, $node);
2094
        return $this->enderExped;
2095
    }
2096
2097
    /**
2098
     * Gera as tags para o elemento: "receb" (Informações do Recebedor da Carga)
2099
     * #160
2100
     * Nível: 1
2101
     * Os parâmetros para esta função são todos os elementos da tag "receb" do
2102
     * tipo elemento (Ele = E|CE|A) e nível 2
2103
     *
2104
     * @param string $CNPJ Número do CNPJ
2105
     * @param string $CPF Número do CPF
2106
     * @param string $IE Inscrição Estadual
2107
     * @param string $xNome Razão Social ou Nome
2108
     * @param string $fone Telefone
2109
     * @param string $email Endereço de email
2110
     *
2111
     * @return \DOMElement
2112
     */
2113 View Code Duplication
    public function recebTag($CNPJ = '', $CPF = '', $IE = '', $xNome = '', $fone = '', $email = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2114
    {
2115
        $identificador = '#160 <receb> - ';
2116
        $this->receb = $this->dom->createElement('receb');
2117
        if ($CNPJ != '') {
2118
            $this->dom->addChild(
2119
                $this->receb,
2120
                'CNPJ',
2121
                $CNPJ,
2122
                true,
2123
                $identificador . 'Número do CNPJ'
2124
            );
2125
        } elseif ($CPF != '') {
2126
            $this->dom->addChild(
2127
                $this->receb,
2128
                'CPF',
2129
                $CPF,
2130
                true,
2131
                $identificador . 'Número do CPF'
2132
            );
2133
        } else {
2134
            $this->dom->addChild(
2135
                $this->receb,
2136
                'CNPJ',
2137
                $CNPJ,
2138
                true,
2139
                $identificador . 'Número do CNPJ'
2140
            );
2141
            $this->dom->addChild(
2142
                $this->receb,
2143
                'CPF',
2144
                $CPF,
2145
                true,
2146
                $identificador . 'Número do CPF'
2147
            );
2148
        }
2149
        $this->dom->addChild(
2150
            $this->receb,
2151
            'IE',
2152
            $IE,
2153
            true,
2154
            $identificador . 'Inscrição Estadual'
2155
        );
2156
        $this->dom->addChild(
2157
            $this->receb,
2158
            'xNome',
2159
            $xNome,
2160
            true,
2161
            $identificador . 'Razão social ou Nome'
2162
        );
2163
        $this->dom->addChild(
2164
            $this->receb,
2165
            'fone',
2166
            $fone,
2167
            false,
2168
            $identificador . 'Telefone'
2169
        );
2170
        $this->dom->addChild(
2171
            $this->receb,
2172
            'email',
2173
            $email,
2174
            false,
2175
            $identificador . 'Endereço de email'
2176
        );
2177
        return $this->receb;
2178
    }
2179
2180
    /**
2181
     * Gera as tags para o elemento: "enderReceb" (Informações do Recebedor da Carga)
2182
     * #166
2183
     * Nível: 2
2184
     * Os parâmetros para esta função são todos os elementos da tag "enderReceb" do
2185
     * tipo elemento (Ele = E|CE|A) e nível 3
2186
     *
2187
     * @param string $xLgr Logradouro
2188
     * @param string $nro Número
2189
     * @param string $xCpl Complemento
2190
     * @param string $xBairro Bairro
2191
     * @param string $cMun Código do município (utilizar a tabela do IBGE)
2192
     * @param string $xMun Nome do município
2193
     * @param string $CEP CEP
2194
     * @param string $UF Sigla da UF
2195
     * @param string $cPais Código do país
2196
     * @param string $xPais Nome do país
2197
     *
2198
     * @return \DOMElement
2199
     */
2200 View Code Duplication
    public function enderRecebTag(
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2201
        $xLgr = '',
2202
        $nro = '',
2203
        $xCpl = '',
2204
        $xBairro = '',
2205
        $cMun = '',
2206
        $xMun = '',
2207
        $CEP = '',
2208
        $UF = '',
2209
        $cPais = '',
2210
        $xPais = ''
2211
    ) {
2212
        $identificador = '#160 <enderReceb> - ';
2213
        $this->enderReceb = $this->dom->createElement('enderReceb');
2214
        $this->dom->addChild(
2215
            $this->enderReceb,
2216
            'xLgr',
2217
            $xLgr,
2218
            true,
2219
            $identificador . 'Logradouro'
2220
        );
2221
        $this->dom->addChild(
2222
            $this->enderReceb,
2223
            'nro',
2224
            $nro,
2225
            true,
2226
            $identificador . 'Número'
2227
        );
2228
        $this->dom->addChild(
2229
            $this->enderReceb,
2230
            'xCpl',
2231
            $xCpl,
2232
            false,
2233
            $identificador . 'Complemento'
2234
        );
2235
        $this->dom->addChild(
2236
            $this->enderReceb,
2237
            'xBairro',
2238
            $xBairro,
2239
            true,
2240
            $identificador . 'Bairro'
2241
        );
2242
        $this->dom->addChild(
2243
            $this->enderReceb,
2244
            'cMun',
2245
            $cMun,
2246
            true,
2247
            $identificador . 'Código do município (utilizar a tabela do IBGE)'
2248
        );
2249
        $this->dom->addChild(
2250
            $this->enderReceb,
2251
            'xMun',
2252
            $xMun,
2253
            true,
2254
            $identificador . 'Nome do município'
2255
        );
2256
        $this->dom->addChild(
2257
            $this->enderReceb,
2258
            'CEP',
2259
            $CEP,
2260
            false,
2261
            $identificador . 'CEP'
2262
        );
2263
        $this->dom->addChild(
2264
            $this->enderReceb,
2265
            'UF',
2266
            $UF,
2267
            true,
2268
            $identificador . 'Sigla da UF'
2269
        );
2270
        $this->dom->addChild(
2271
            $this->enderReceb,
2272
            'cPais',
2273
            $cPais,
2274
            false,
2275
            $identificador . 'Código do país'
2276
        );
2277
        $this->dom->addChild(
2278
            $this->enderReceb,
2279
            'xPais',
2280
            $xPais,
2281
            false,
2282
            $identificador . 'Nome do país'
2283
        );
2284
        $node = $this->receb->getElementsByTagName("email")->item(0);
2285
        $this->receb->insertBefore($this->enderReceb, $node);
2286
        return $this->enderReceb;
2287
    }
2288
2289
    /**
2290
     * Gera as tags para o elemento: "dest" (Informações do Destinatário do CT-e)
2291
     * #178
2292
     * Nível: 1
2293
     * Os parâmetros para esta função são todos os elementos da tag "dest" do
2294
     * tipo elemento (Ele = E|CE|A) e nível 2
2295
     *
2296
     * @param string $CNPJ Número do CNPJ
2297
     * @param string $CPF Número do CPF
2298
     * @param string $IE Inscrição Estadual
2299
     * @param string $xNome Razão Social ou Nome
2300
     * @param string $fone Telefone
2301
     * @param string $ISUF Inscrição na SUFRAMA
2302
     * @param string $email Endereço de email
2303
     *
2304
     * @return \DOMElement
2305
     */
2306 3 View Code Duplication
    public function destTag($CNPJ = '', $CPF = '', $IE = '', $xNome = '', $fone = '', $ISUF = '', $email = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2307
    {
2308 3
        $identificador = '#178 <dest> - ';
2309 3
        $this->dest = $this->dom->createElement('dest');
2310 3
        if ($CNPJ != '') {
2311 3
            $this->dom->addChild(
2312 3
                $this->dest,
2313 3
                'CNPJ',
2314 3
                $CNPJ,
2315 3
                true,
2316 1
                $identificador . 'Número do CNPJ'
2317 2
            );
2318 2
        } elseif ($CPF != '') {
2319
            $this->dom->addChild(
2320
                $this->dest,
2321
                'CPF',
2322
                $CPF,
2323
                true,
2324
                $identificador . 'Número do CPF'
2325
            );
2326
        } else {
2327
            $this->dom->addChild(
2328
                $this->dest,
2329
                'CNPJ',
2330
                $CNPJ,
2331
                true,
2332
                $identificador . 'Número do CNPJ'
2333
            );
2334
            $this->dom->addChild(
2335
                $this->dest,
2336
                'CPF',
2337
                $CPF,
2338
                true,
2339
                $identificador . 'Número do CPF'
2340
            );
2341
        }
2342 3
        $this->dom->addChild(
2343 3
            $this->dest,
2344 3
            'IE',
2345 3
            $IE,
2346 3
            true,
2347 1
            $identificador . 'Inscrição Estadual'
2348 2
        );
2349 3
        $this->dom->addChild(
2350 3
            $this->dest,
2351 3
            'xNome',
2352 3
            $xNome,
2353 3
            true,
2354 1
            $identificador . 'Razão social ou Nome'
2355 2
        );
2356 3
        $this->dom->addChild(
2357 3
            $this->dest,
2358 3
            'fone',
2359 3
            $fone,
2360 3
            false,
2361 1
            $identificador . 'Telefone'
2362 2
        );
2363 3
        $this->dom->addChild(
2364 3
            $this->dest,
2365 3
            'ISUF',
2366 3
            $ISUF,
2367 3
            false,
2368 1
            $identificador . 'Inscrição na SUFRAMA'
2369 2
        );
2370 3
        $this->dom->addChild(
2371 3
            $this->dest,
2372 3
            'email',
2373 3
            $email,
2374 3
            false,
2375 1
            $identificador . 'Endereço de email'
2376 2
        );
2377 3
        return $this->dest;
2378
    }
2379
2380
    /**
2381
     * Gera as tags para o elemento: "enderDest" (Informações do Recebedor da Carga)
2382
     * # = 185
2383
     * Nível = 2
2384
     * Os parâmetros para esta função são todos os elementos da tag "enderDest" do
2385
     * tipo elemento (Ele = E|CE|A) e nível 3
2386
     *
2387
     * @param string $xLgr Logradouro
2388
     * @param string $nro Número
2389
     * @param string $xCpl Complemento
2390
     * @param string $xBairro Bairro
2391
     * @param string $cMun Código do município (utilizar a tabela do IBGE)
2392
     * @param string $xMun Nome do município
2393
     * @param string $CEP CEP
2394
     * @param string $UF Sigla da UF
2395
     * @param string $cPais Código do país
2396
     * @param string $xPais Nome do país
2397
     *
2398
     * @return \DOMElement
2399
     */
2400 3 View Code Duplication
    public function enderDestTag(
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2401
        $xLgr = '',
2402
        $nro = '',
2403
        $xCpl = '',
2404
        $xBairro = '',
2405
        $cMun = '',
2406
        $xMun = '',
2407
        $CEP = '',
2408
        $UF = '',
2409
        $cPais = '',
2410
        $xPais = ''
2411
    ) {
2412 3
        $identificador = '#185 <enderDest> - ';
2413 3
        $this->enderDest = $this->dom->createElement('enderDest');
2414 3
        $this->dom->addChild(
2415 3
            $this->enderDest,
2416 3
            'xLgr',
2417 3
            $xLgr,
2418 3
            true,
2419 1
            $identificador . 'Logradouro'
2420 2
        );
2421 3
        $this->dom->addChild(
2422 3
            $this->enderDest,
2423 3
            'nro',
2424 3
            $nro,
2425 3
            true,
2426 1
            $identificador . 'Número'
2427 2
        );
2428 3
        $this->dom->addChild(
2429 3
            $this->enderDest,
2430 3
            'xCpl',
2431 3
            $xCpl,
2432 3
            false,
2433 1
            $identificador . 'Complemento'
2434 2
        );
2435 3
        $this->dom->addChild(
2436 3
            $this->enderDest,
2437 3
            'xBairro',
2438 3
            $xBairro,
2439 3
            true,
2440 1
            $identificador . 'Bairro'
2441 2
        );
2442 3
        $this->dom->addChild(
2443 3
            $this->enderDest,
2444 3
            'cMun',
2445 3
            $cMun,
2446 3
            true,
2447 1
            $identificador . 'Código do município (utilizar a tabela do IBGE)'
2448 2
        );
2449 3
        $this->dom->addChild(
2450 3
            $this->enderDest,
2451 3
            'xMun',
2452 3
            $xMun,
2453 3
            true,
2454 1
            $identificador . 'Nome do município'
2455 2
        );
2456 3
        $this->dom->addChild(
2457 3
            $this->enderDest,
2458 3
            'CEP',
2459 3
            $CEP,
2460 3
            false,
2461 1
            $identificador . 'CEP'
2462 2
        );
2463 3
        $this->dom->addChild(
2464 3
            $this->enderDest,
2465 3
            'UF',
2466 3
            $UF,
2467 3
            true,
2468 1
            $identificador . 'Sigla da UF'
2469 2
        );
2470 3
        $this->dom->addChild(
2471 3
            $this->enderDest,
2472 3
            'cPais',
2473 3
            $cPais,
2474 3
            false,
2475 1
            $identificador . 'Código do país'
2476 2
        );
2477 3
        $this->dom->addChild(
2478 3
            $this->enderDest,
2479 3
            'xPais',
2480 3
            $xPais,
2481 3
            false,
2482 1
            $identificador . 'Nome do país'
2483 2
        );
2484 3
        $node = $this->dest->getElementsByTagName("email")->item(0);
2485 3
        $this->dest->insertBefore($this->enderDest, $node);
2486 3
        return $this->enderDest;
2487
    }
2488
2489
    /**
2490
     * Gera as tags para o elemento: "vPrest" (Valores da Prestação de Serviço)
2491
     * #208
2492
     * Nível: 1
2493
     * Os parâmetros para esta função são todos os elementos da tag "vPrest" do
2494
     * tipo elemento (Ele = E|CE|A) e nível 2
2495
     *
2496
     * @param string $vTPrest Valor Total da Prestação do Serviço
2497
     * @param string $vRec Valor a Receber
2498
     *
2499
     * @return \DOMElement
2500
     */
2501 3 View Code Duplication
    public function vPrestTag($vTPrest = '', $vRec = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2502
    {
2503 3
        $identificador = '#208 <vPrest> - ';
2504 3
        $this->vPrest = $this->dom->createElement('vPrest');
2505 3
        $this->dom->addChild(
2506 3
            $this->vPrest,
2507 3
            'vTPrest',
2508 3
            $vTPrest,
2509 3
            true,
2510 1
            $identificador . 'Valor Total da Prestação do Serviço'
2511 2
        );
2512 3
        $this->dom->addChild(
2513 3
            $this->vPrest,
2514 3
            'vRec',
2515 3
            $vRec,
2516 3
            true,
2517 1
            $identificador . 'Valor a Receber'
2518 2
        );
2519 3
        return $this->vPrest;
2520
    }
2521
2522
    /**
2523
     * tagICMS
2524
     * Informações do ICMS da Operação própria e ST N01 pai M01
2525
     * tag NFe/infNFe/det[]/imposto/ICMS
2526
     * @param string $cst
2527
     * @param string $pRedBC
2528
     * @param string $vBC
2529
     * @param string $pICMS
2530
     * @param string $vICMS
2531
     * @param string $vBCSTRet
2532
     * @param string $vICMSSTRet
2533
     * @param string $pICMSSTRet
2534
     * @param string $vCred
2535
     * @param string $vTotTrib
2536
     * @param bool $outraUF
2537
     * @param string $vBCUFFim
2538
     * @param string $pFCPUFFim
2539
     * @param string $pICMSUFFim
2540
     * @param string $pICMSInter
2541
     * @param string $pICMSInterPart
2542
     * @param string $vFCPUFFim
2543
     * @param string $vICMSUFFim
2544
     * @param string $vICMSUFIni
2545
     * @return DOMElement
2546
     */
2547 3
    public function icmsTag(
2548
        $cst = '',
2549
        $pRedBC = '',
2550
        $vBC = '',
2551
        $pICMS = '',
2552
        $vICMS = '',
2553
        $vBCSTRet = '',
2554
        $vICMSSTRet = '',
2555
        $pICMSSTRet = '',
2556
        $vCred = '',
2557
        $vTotTrib = 0,
2558
        $outraUF = false,
2559
        $vBCUFFim = '',
2560
        $pFCPUFFim = '',
2561
        $pICMSUFFim = '',
2562
        $pICMSInter = '',
2563
        $pICMSInterPart = '',
2564
        $vFCPUFFim = '',
2565
        $vICMSUFFim = 0,
2566
        $vICMSUFIni = 0
2567
    ) {
2568 3
        $identificador = 'N01 <ICMSxx> - ';
2569
        switch ($cst) {
2570 3
            case '00':
2571 3
                $icms = $this->dom->createElement("ICMS00");
2572 3
                $this->dom->addChild($icms, 'CST', $cst, true, "$identificador  Tributação do ICMS = 00");
2573 3
                $this->dom->addChild($icms, 'vBC', $vBC, true, "$identificador  Valor da BC do ICMS");
2574 3
                $this->dom->addChild($icms, 'pICMS', $pICMS, true, "$identificador  Alíquota do imposto");
2575 3
                $this->dom->addChild($icms, 'vICMS', $vICMS, true, "$identificador  Valor do ICMS");
2576 3
                break;
2577
            case '20':
2578
                $icms = $this->dom->createElement("ICMS20");
2579
                $this->dom->addChild($icms, 'CST', $cst, true, "$identificador  Tributação do ICMS = 20");
2580
                $this->dom->addChild($icms, 'pRedBC', $pRedBC, true, "$identificador  Percentual da Redução de BC");
2581
                $this->dom->addChild($icms, 'vBC', $vBC, true, "$identificador  Valor da BC do ICMS");
2582
                $this->dom->addChild($icms, 'pICMS', $pICMS, true, "$identificador  Alíquota do imposto");
2583
                $this->dom->addChild($icms, 'vICMS', $vICMS, true, "$identificador  Valor do ICMS");
2584
                break;
2585
            case '40':
2586
                $icms = $this->dom->createElement("ICMS45");
2587
                $this->dom->addChild($icms, 'CST', $cst, true, "$identificador  Tributação do ICMS = 40");
2588
                break;
2589
            case '41':
2590
                $icms = $this->dom->createElement("ICMS45");
2591
                $this->dom->addChild($icms, 'CST', $cst, true, "$identificador  Tributação do ICMS = 41");
2592
                break;
2593
            case '51':
2594
                $icms = $this->dom->createElement("ICMS45");
2595
                $this->dom->addChild($icms, 'CST', $cst, true, "$identificador  Tributação do ICMS = 51");
2596
                break;
2597
            case '60':
2598
                $icms = $this->dom->createElement("ICMS60");
2599
                $this->dom->addChild($icms, 'CST', $cst, true, "$identificador  Tributação do ICMS = 60");
2600
                $this->dom->addChild($icms, 'vBCSTRet', $vBCSTRet, true, "$identificador  Valor BC do ICMS ST retido");
2601
                $this->dom->addChild($icms, 'vICMSSTRet', $vICMSSTRet, true, "$identificador  Valor do ICMS ST retido");
2602
                $this->dom->addChild($icms, 'pICMSSTRet', $pICMSSTRet, true, "$identificador  Valor do ICMS ST retido");
2603
                if ($vCred > 0) {
2604
                    $this->dom->addChild($icms, 'vCred', $vCred, false, "$identificador  Valor do Crédito");
2605
                }
2606
                break;
2607
            case '90':
2608
                if ($outraUF == true) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
2609
                    $icms = $this->dom->createElement("ICMSOutraUF");
2610
                    $this->dom->addChild($icms, 'CST', $cst, true, "$identificador  Tributação do ICMS = 90");
2611
                    if ($pRedBC > 0) {
2612
                        $this->dom->addChild($icms, 'pRedBCOutraUF', $pRedBC, false, "$identificador Percentual Red "
2613
                            . "BC Outra UF");
2614
                    }
2615
                    $this->dom->addChild($icms, 'vBCOutraUF', $vBC, true, "$identificador Valor BC ICMS Outra UF");
2616
                    $this->dom->addChild($icms, 'pICMSOutraUF', $pICMS, true, "$identificador Alíquota do "
2617
                        . "imposto Outra UF");
2618
                    $this->dom->addChild($icms, 'vICMSOutraUF', $vICMS, true, "$identificador Valor ICMS Outra UF");
2619
                } else {
2620
                    $icms = $this->dom->createElement("ICMS90");
2621
                    $this->dom->addChild($icms, 'CST', $cst, true, "$identificador Tributação do ICMS = 90");
2622
                    if ($pRedBC > 0) {
2623
                        $this->dom->addChild($icms, 'pRedBC', $pRedBC, false, "$identificador Percentual Redução BC");
2624
                    }
2625
                    $this->dom->addChild($icms, 'vBC', $vBC, true, "$identificador  Valor da BC do ICMS");
2626
                    $this->dom->addChild($icms, 'pICMS', $pICMS, true, "$identificador  Alíquota do imposto");
2627
                    $this->dom->addChild($icms, 'vICMS', $vICMS, true, "$identificador  Valor do ICMS");
2628
                    if ($vCred > 0) {
2629
                        $this->dom->addChild($icms, 'vCred', $vCred, false, "$identificador  Valor do Crédido");
2630
                    }
2631
                }
2632
                break;
2633
            case 'SN':
2634
                $icms = $this->dom->createElement("ICMSSN");
2635
                $this->dom->addChild($icms, 'CST', 90, true, "$identificador Tributação do ICMS = 90");
2636
                $this->dom->addChild($icms, 'indSN', '1', true, "$identificador  Indica se contribuinte é SN");
2637
                break;
2638
        }
2639 3
        $this->imp = $this->dom->createElement('imp');
2640 3
        $tagIcms = $this->dom->createElement('ICMS');
2641 3
        if (isset($icms)) {
2642 3
            $this->imp->appendChild($tagIcms);
2643 2
        }
2644 3
        if (isset($icms)) {
2645 3
            $tagIcms->appendChild($icms);
2646 2
        }
2647 3
        if ($vTotTrib > 0) {
2648 3
            $this->dom->addChild($this->imp, 'vTotTrib', $vTotTrib, false, "$identificador Valor Total dos Tributos");
2649 2
        }
2650
        
2651 3
        if ($vICMSUFFim > 0 || $vICMSUFIni > 0) {
2652
            $icmsDifal = $this->dom->createElement("ICMSUFFim");
2653
            $this->dom->addChild($icmsDifal, 'vBCUFFim', $vBCUFFim, true, "$identificador Valor da BC do ICMS na UF 
2654
                de término da prestação do serviço de transporte");
2655
            $this->dom->addChild($icmsDifal, 'pFCPUFFim', $pFCPUFFim, true, "$identificador Percentual do ICMS 
2656
                relativo ao Fundo de Combate à pobreza (FCP) na UF de término da prestação do serviço de 
2657
                transporte");
2658
            $this->dom->addChild($icmsDifal, 'pICMSUFFim', $pICMSUFFim, true, "$identificador Alíquota interna da UF 
2659
                de término da prestação do serviço de transporte");
2660
            $this->dom->addChild($icmsDifal, 'pICMSInter', $pICMSInter, true, "$identificador Alíquota interestadual 
2661
                das UF envolvidas");
2662
            $this->dom->addChild($icmsDifal, 'pICMSInterPart', $pICMSInterPart, true, "$identificador Percentual 
2663
                provisório de partilha entre os estados");
2664
            $this->dom->addChild($icmsDifal, 'vFCPUFFim', $vFCPUFFim, true, "$identificador Valor do ICMS relativo 
2665
                ao Fundo de Combate á Pobreza (FCP) da UF de término da prestação");
2666
            $this->dom->addChild($icmsDifal, 'vICMSUFFim', $vICMSUFFim, true, "$identificador Valor do ICMS de 
2667
                partilha para a UF de término da prestação do serviço de transporte");
2668
            $this->dom->addChild($icmsDifal, 'vICMSUFIni', $vICMSUFIni, true, "$identificador Valor do ICMS de 
2669
                partilha para a UF de início da prestação do serviço de transporte");
2670
            
2671
            $this->imp->appendChild($icmsDifal);
2672
        }
2673
2674 3
        return $tagIcms;
2675
    }
2676
2677
    /**
2678
     * Gera as tags para o elemento: "Comp" (Componentes do Valor da Prestação)
2679
     * #211
2680
     * Nível: 2
2681
     * Os parâmetros para esta função são todos os elementos da tag "Comp" do
2682
     * tipo elemento (Ele = E|CE|A) e nível 3
2683
     *
2684
     * @param string $xNome Nome do componente
2685
     * @param string $vComp Valor do componente
2686
     *
2687
     * @return \DOMElement
2688
     */
2689 3 View Code Duplication
    public function compTag($xNome = '', $vComp = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2690
    {
2691 3
        $identificador = '#65 <pass> - ';
2692 3
        $this->comp[] = $this->dom->createElement('Comp');
2693 3
        $posicao = (integer)count($this->comp) - 1;
2694 3
        $this->dom->addChild(
2695 3
            $this->comp[$posicao],
2696 3
            'xNome',
2697 3
            $xNome,
2698 3
            false,
2699 1
            $identificador . 'Nome do componente'
2700 2
        );
2701 3
        $this->dom->addChild(
2702 3
            $this->comp[$posicao],
2703 3
            'vComp',
2704 3
            $vComp,
2705 3
            false,
2706 1
            $identificador . 'Valor do componente'
2707 2
        );
2708 3
        return $this->comp[$posicao];
2709
    }
2710
2711
    /**
2712
     * Tag raiz do documento xml
2713
     * Função chamada pelo método [ monta ]
2714
     * @return \DOMElement
2715
     */
2716
    private function zCTeTag()
2717
    {
2718
        if (empty($this->CTe)) {
2719
            $this->CTe = $this->dom->createElement('CTe');
2720
            $this->CTe->setAttribute('xmlns', 'http://www.portalfiscal.inf.br/cte');
2721
        }
2722
        return $this->CTe;
2723
    }
2724
2725
    /**
2726
     * Gera as tags para o elemento: "Entrega" (Informações ref. a previsão de entrega)
2727
     * #69
2728
     * Nível: 2
2729
     * Os parâmetros para esta função são todos os elementos da tag "Entrega" do
2730
     * tipo elemento (Ele = E|CE|A) e nível 3
2731
     *
2732
     * @return \DOMElement
2733
     */
2734
    private function zEntregaTag()
2735
    {
2736
        $this->entrega = $this->dom->createElement('Entrega');
2737
        return $this->entrega;
2738
    }
2739
2740 3
    public function infCTeNormTag()
2741
    {
2742 3
        $this->infCTeNorm = $this->dom->createElement('infCTeNorm');
2743 3
        return $this->infCTeNorm;
2744
    }
2745
2746
    /**
2747
     * Gera as tags para o elemento: "Comp" (Informações da Carga do CT-e)
2748
     * #253
2749
     * Nível: 2
2750
     * Os parâmetros para esta função são todos os elementos da tag "infCarga"
2751
     * @param string $vCarga Valor total da carga
2752
     * @param string $proPred Produto predominante
2753
     * @param string $xOutCat Outras características da carga
2754
     * @param string $vCargaAverb
2755
     *
2756
     * @return \DOMElement
2757
     */
2758 3
    public function infCargaTag($vCarga = '', $proPred = '', $xOutCat = '', $vCargaAverb = '')
2759
    {
2760 3
        $identificador = '#253 <infCarga> - ';
2761 3
        $this->infCarga = $this->dom->createElement('infCarga');
2762 3
        $this->dom->addChild($this->infCarga, 'vCarga', $vCarga, false, $identificador . 'Valor Total da Carga');
2763 3
        $this->dom->addChild($this->infCarga, 'proPred', $proPred, true, $identificador . 'Produto Predominante');
2764 3
        $this->dom->addChild($this->infCarga, 'xOutCat', $xOutCat, false, $identificador . 'Outras Caract. da Carga');
2765 3
        $this->dom->addChild($this->infCarga, 'vCargaAverb', $vCargaAverb, false, $identificador . 'Valor da Carga para 
2766 2
            efeito de averbação');
2767
2768 3
        return $this->infCarga;
2769
    }
2770
2771
    /**
2772
     * Gera as tags para o elemento: "infQ" (Informações de quantidades da Carga do CT-e)
2773
     * #257
2774
     * Nível: 3
2775
     * Os parâmetros para esta função são todos os elementos da tag "infQ"
2776
     * @param string $cUnid Código da Unidade de Medida
2777
     * @param string $tpMed Tipo da Medida
2778
     * @param string $qCarga Quantidade
2779
     * @return mixed
2780
     */
2781 3
    public function infQTag($cUnid = '', $tpMed = '', $qCarga = '')
2782
    {
2783 3
        $identificador = '#257 <infQ> - ';
2784 3
        $this->infQ[] = $this->dom->createElement('infQ');
2785 3
        $posicao = (integer)count($this->infQ) - 1;
2786 3
        $this->dom->addChild($this->infQ[$posicao], 'cUnid', $cUnid, true, $identificador . 'Código da 
2787 2
            Unidade de Medida');
2788 3
        $this->dom->addChild($this->infQ[$posicao], 'tpMed', $tpMed, true, $identificador . 'Tipo da Medida');
2789 3
        $this->dom->addChild($this->infQ[$posicao], 'qCarga', $qCarga, true, $identificador . 'Quantidade');
2790
2791 3
        return $this->infQ[$posicao];
2792
    }
2793
2794 3
    public function infDocTag()
2795
    {
2796 3
        $this->infDoc = $this->dom->createElement('infDoc');
2797 3
        return $this->infDoc;
2798
    }
2799
2800
    /**
2801
     * Documentos de Transporte Anterior
2802
     * @return DOMElement|\DOMNode
2803
     */
2804
    public function docAntTag()
2805
    {
2806
        $this->docAnt = $this->dom->createElement('docAnt');
2807
        return $this->docAnt;
2808
    }
2809
2810
    /**
2811
     * Informações de identificação dos documentos de Transporte Anterior
2812
     * @return array|DOMElement
2813
     */
2814
    public function idDocAntTag()
2815
    {
2816
        $this->idDocAnt = $this->dom->createElement('idDocAnt');
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->dom->createElement('idDocAnt') of type object<DOMElement> is incompatible with the declared type array of property $idDocAnt.

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...
2817
        return $this->idDocAnt;
2818
    }
2819
2820
    /**
2821
     * Gera as tags para o elemento: "infNF" (Informações das NF)
2822
     * #262
2823
     * Nível: 3
2824
     * @param string $nRoma
2825
     * @param string $nPed
2826
     * @param string $mod
2827
     * @param string $serie
2828
     * @param string $nDoc
2829
     * @param string $dEmi
2830
     * @param string $vBC
2831
     * @param string $vICMS
2832
     * @param string $vBCST
2833
     * @param string $vST
2834
     * @param string $vProd
2835
     * @param string $vNF
2836
     * @param string $nCFOP
2837
     * @param string $nPeso
2838
     * @param string $PIN
2839
     * @param string $dPrev
2840
     * @return mixed
2841
     */
2842
    public function infNFTag(
2843
        $nRoma = '',
2844
        $nPed = '',
2845
        $mod = '',
2846
        $serie = '',
2847
        $nDoc = '',
2848
        $dEmi = '',
2849
        $vBC = '',
2850
        $vICMS = '',
2851
        $vBCST = '',
2852
        $vST = '',
2853
        $vProd = '',
2854
        $vNF = '',
2855
        $nCFOP = '',
2856
        $nPeso = '',
2857
        $PIN = '',
2858
        $dPrev = ''
2859
    ) {
2860
        $identificador = '#262 <infNF> - ';
2861
        $this->infNF[] = $this->dom->createElement('infNF');
2862
        $posicao = (integer)count($this->infNF) - 1;
2863
2864
        $this->dom->addChild($this->infNF[$posicao], 'nRoma', $nRoma, false, $identificador . 'Número do 
2865
            Romaneio da NF');
2866
        $this->dom->addChild($this->infNF[$posicao], 'nPed', $nPed, false, $identificador . 'Número do 
2867
            Pedido da NF');
2868
        $this->dom->addChild($this->infNF[$posicao], 'mod', $mod, true, $identificador . 'Modelo da 
2869
            Nota Fiscal');
2870
        $this->dom->addChild($this->infNF[$posicao], 'serie', $serie, true, $identificador . 'Série');
2871
        $this->dom->addChild($this->infNF[$posicao], 'nDoc', $nDoc, true, $identificador . 'Número');
2872
        $this->dom->addChild($this->infNF[$posicao], 'dEmi', $dEmi, true, $identificador . 'Data de Emissão');
2873
        $this->dom->addChild($this->infNF[$posicao], 'vBC', $vBC, true, $identificador . 'Valor da Base 
2874
            de Cálculo do ICMS');
2875
        $this->dom->addChild($this->infNF[$posicao], 'vICMS', $vICMS, true, $identificador . 'Valor Total 
2876
            do ICMS');
2877
        $this->dom->addChild($this->infNF[$posicao], 'vBCST', $vBCST, true, $identificador . 'Valor da 
2878
            Base de Cálculo do ICMS ST');
2879
        $this->dom->addChild($this->infNF[$posicao], 'vST', $vST, true, $identificador . 'Valor Total 
2880
            do ICMS ST');
2881
        $this->dom->addChild($this->infNF[$posicao], 'vProd', $vProd, true, $identificador . 'Valor Total
2882
            dos Produtos');
2883
        $this->dom->addChild($this->infNF[$posicao], 'vNF', $vNF, true, $identificador . 'Valor Total da NF');
2884
        $this->dom->addChild($this->infNF[$posicao], 'nCFOP', $nCFOP, true, $identificador . 'CFOP Predominante');
2885
        $this->dom->addChild($this->infNF[$posicao], 'nPeso', $nPeso, false, $identificador . 'Peso total em Kg');
2886
        $this->dom->addChild($this->infNF[$posicao], 'PIN', $PIN, false, $identificador . 'PIN SUFRAMA');
2887
        $this->dom->addChild($this->infNF[$posicao], 'dPrev', $dPrev, false, $identificador . 'Data prevista
2888
            de entrega');
2889
2890
        return $this->infNF[$posicao];
2891
    }
2892
2893
    /**
2894
     * Gera as tags para o elemento: "infNFe" (Informações das NF-e)
2895
     * #297
2896
     * Nível: 3
2897
     * @param string $chave
2898
     * @param string $PIN
2899
     * @param string $dPrev
2900
     * @return mixed
2901
     */
2902 3 View Code Duplication
    public function infNFeTag($chave = '', $PIN = '', $dPrev = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2903
    {
2904 3
        $identificador = '#297 <infNFe> - ';
2905 3
        $this->infNFe[] = $this->dom->createElement('infNFe');
2906 3
        $posicao = (integer)count($this->infNFe) - 1;
2907 3
        $this->dom->addChild(
2908 3
            $this->infNFe[$posicao],
2909 3
            'chave',
2910 3
            $chave,
2911 3
            true,
2912 1
            $identificador . 'Chave de acesso da NF-e'
2913 2
        );
2914 3
        $this->dom->addChild(
2915 3
            $this->infNFe[$posicao],
2916 3
            'PIN',
2917 3
            $PIN,
2918 3
            false,
2919 1
            $identificador . 'PIN SUFRAMA'
2920 2
        );
2921 3
        $this->dom->addChild(
2922 3
            $this->infNFe[$posicao],
2923 3
            'dPrev',
2924 3
            $dPrev,
2925 3
            false,
2926 1
            $identificador . 'Data prevista de entrega'
2927 2
        );
2928 3
        return $this->infNFe[$posicao];
2929
    }
2930
2931
    /**
2932
     * Gera as tags para o elemento: "infOutros" (Informações dos demais documentos)
2933
     * #319
2934
     * Nível: 3
2935
     * @param string $tpDoc
2936
     * @param string $descOutros
2937
     * @param string $nDoc
2938
     * @param string $dEmi
2939
     * @param string $vDocFisc
2940
     * @param string $dPrev
2941
     * @return mixed
2942
     */
2943
    public function infOutrosTag($tpDoc = '', $descOutros = '', $nDoc = '', $dEmi = '', $vDocFisc = '', $dPrev = '')
2944
    {
2945
        $ident = '#319 <infOutros> - ';
2946
        $this->infOutros[] = $this->dom->createElement('infOutros');
2947
        $posicao = (integer)count($this->infOutros) - 1;
2948
        $this->dom->addChild($this->infOutros[$posicao], 'tpDoc', $tpDoc, true, $ident . 'Tipo '
2949
            . 'de documento originário');
2950
        $this->dom->addChild($this->infOutros[$posicao], 'descOutros', $descOutros, false, $ident . 'Descrição '
2951
            . 'do documento');
2952
        $this->dom->addChild($this->infOutros[$posicao], 'nDoc', $nDoc, false, $ident . 'Número '
2953
            . 'do documento');
2954
        $this->dom->addChild($this->infOutros[$posicao], 'dEmi', $dEmi, false, $ident . 'Data de Emissão');
2955
        $this->dom->addChild($this->infOutros[$posicao], 'vDocFisc', $vDocFisc, false, $ident . 'Valor '
2956
            . 'do documento');
2957
        $this->dom->addChild($this->infOutros[$posicao], 'dPrev', $dPrev, false, $ident . 'Data '
2958
            . 'prevista de entrega');
2959
        return $this->infOutros[$posicao];
2960
    }
2961
2962
    /**
2963
     * Gera as tags para o elemento: "emiDocAnt" (Informações dos CT-es Anteriores)
2964
     * #345
2965
     * Nível: 3
2966
     * @param string $CNPJ
2967
     * @param string $CPF
2968
     * @param string $IE
2969
     * @param string $UF
2970
     * @param string $xNome
2971
     * @return mixed
2972
     */
2973
    public function emiDocAntTag($CNPJ = '', $CPF = '', $IE = '', $UF = '', $xNome = '')
2974
    {
2975
        $identificador = '#345 <emiDocAnt> - ';
2976
        $this->emiDocAnt[] = $this->dom->createElement('emiDocAnt');
2977
        $posicao = (integer)count($this->emiDocAnt) - 1;
2978
        if ($CNPJ != '') {
2979
            $this->dom->addChild($this->emiDocAnt[$posicao], 'CNPJ', $CNPJ, true, $identificador . 'Número do CNPJ');
2980
            $this->dom->addChild($this->emiDocAnt[$posicao], 'IE', $IE, true, $identificador . 'Inscrição Estadual');
2981
            $this->dom->addChild($this->emiDocAnt[$posicao], 'UF', $UF, true, $identificador . 'Sigla da UF');
2982
        } else {
2983
            $this->dom->addChild($this->emiDocAnt[$posicao], 'CPF', $CPF, true, $identificador . 'Número do CPF');
2984
        }
2985
        $this->dom->addChild($this->emiDocAnt[$posicao], 'xNome', $xNome, true, $identificador . 'Razão Social ou '
2986
            . ' Nome do Expedidor');
2987
2988
        return $this->emiDocAnt[$posicao];
2989
    }
2990
2991
    /**
2992
     * Gera as tags para o elemento: "idDocAntEle" (Informações dos CT-es Anteriores)
2993
     * #358
2994
     * Nível: 4
2995
     * @param string $chCTe
2996
     * @return mixed
2997
     */
2998 View Code Duplication
    public function idDocAntEleTag($chCTe = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2999
    {
3000
        $identificador = '#358 <idDocAntEle> - ';
3001
        $this->idDocAntEle[] = $this->dom->createElement('idDocAntEle');
3002
        $posicao = (integer)count($this->idDocAntEle) - 1;
3003
        $this->dom->addChild($this->idDocAntEle[$posicao], 'chCTe', $chCTe, true, $identificador . 'Chave de '
3004
            . 'Acesso do CT-e');
3005
3006
        return $this->idDocAntEle[$posicao];
3007
    }
3008
3009
3010
    /**
3011
     * Gera as tags para o elemento: "seg" (Informações de Seguro da Carga)
3012
     * #360
3013
     * Nível: 2
3014
     * @param int $respSeg
3015
     * @param string $xSeg
3016
     * @param string $nApol
3017
     * @return mixed
3018
     */
3019 3 View Code Duplication
    public function segTag($respSeg = 4, $xSeg = '', $nApol = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3020
    {
3021 3
        $identificador = '#360 <seg> - ';
3022 3
        $this->seg[] = $this->dom->createElement('seg');
3023 3
        $posicao = (integer)count($this->seg) - 1;
3024
3025 3
        $this->dom->addChild($this->seg[$posicao], 'respSeg', $respSeg, true, $identificador . 'Responsável 
3026 2
            pelo Seguro');
3027 3
        $this->dom->addChild($this->seg[$posicao], 'xSeg', $xSeg, false, $identificador . 'Nome da 
3028 2
            Seguradora');
3029 3
        $this->dom->addChild($this->seg[$posicao], 'nApol', $nApol, false, $identificador . 'Número da Apólice');
3030 3
        return $this->seg[$posicao];
3031
    }
3032
3033
    /**
3034
     * Gera as tags para o elemento: "infModal" (Informações do modal)
3035
     * #366
3036
     * Nível: 2
3037
     * @param string $versaoModal
3038
     * @return DOMElement|\DOMNode
3039
     */
3040 3
    public function infModalTag($versaoModal = '')
3041
    {
3042 3
        $identificador = '#366 <infModal> - ';
0 ignored issues
show
Unused Code introduced by
$identificador 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...
3043 3
        $this->infModal = $this->dom->createElement('infModal');
3044 3
        $this->infModal->setAttribute('versaoModal', $versaoModal);
3045 3
        return $this->infModal;
3046
    }
3047
3048
    /**
3049
     * Leiaute - Rodoviário
3050
     * Gera as tags para o elemento: "rodo" (Informações do modal Rodoviário)
3051
     * #1
3052
     * Nível: 0
3053
     * @param string $RNTRC
3054
     * @return DOMElement|\DOMNode
3055
     */
3056 3
    public function rodoTag($RNTRC = '')
3057
    {
3058 3
        $identificador = '#1 <rodo> - ';
3059 3
        $this->rodo = $this->dom->createElement('rodo');
3060 3
        $this->dom->addChild($this->rodo, 'RNTRC', $RNTRC, true, $identificador . 'Registro nacional de transportadores
3061 2
            rodoviários de carga');
3062
3063 3
        return $this->rodo;
3064
    }
3065
3066
    /**
3067
     * Leiaute - Rodoviário
3068
     * Gera as tags para o elemento: "veic" (Dados dos Veículos)
3069
     * #21
3070
     * Nível: 1
3071
     * @param string $cInt
3072
     * @param string $RENAVAM
3073
     * @param string $placa
3074
     * @param string $tara
3075
     * @param string $capKG
3076
     * @param string $capM3
3077
     * @param string $tpProp
3078
     * @param string $tpVeic
3079
     * @param string $tpRod
3080
     * @param string $tpCar
3081
     * @param string $UF
3082
     * @param string $CPF
3083
     * @param string $CNPJ
3084
     * @param string $RNTRC
3085
     * @param string $xNome
3086
     * @param string $IE
3087
     * @param string $propUF
3088
     * @param string $tpPropProp
3089
     * @return mixed
3090
     */
3091 3
    public function veicTag(
3092
        $cInt = '',
3093
        $RENAVAM = '',
3094
        $placa = '',
3095
        $tara = '',
3096
        $capKG = '',
3097
        $capM3 = '',
3098
        $tpProp = '',
3099
        $tpVeic = '',
3100
        $tpRod = '',
3101
        $tpCar = '',
3102
        $UF = '',
3103
        $CPF = '',
3104
        // Informar os zeros não significativos.
3105
        $CNPJ = '',
3106
        // Informar os zeros não significativos.
3107
        $RNTRC = '',
3108
        // Registro obrigatório do proprietário
3109
        $xNome = '',
3110
        // Nome do proprietário
3111
        $IE = '',
3112
        // Inscrição estadual caso seja Pessoa Jurídica
3113
        $propUF = '',
3114
        // Sigla da UF,
3115
        $tpPropProp = ''
3116
    ) {
3117 3
        $identificador = '#21 <veic> - ';
3118 3
        $this->veic[] = $this->dom->createElement('veic');
3119 3
        $posicao = (integer)count($this->veic) - 1;
3120 3
        if ($cInt != '') {
3121 3
            $this->dom->addChild(
3122 3
                $this->veic[$posicao],
3123 3
                'cInt',
3124 3
                $cInt,
3125 3
                false,
3126 1
                $identificador . 'Código interno do veículo'
3127 2
            );
3128 2
        }
3129 3
        $this->dom->addChild(
3130 3
            $this->veic[$posicao],
3131 3
            'RENAVAM',
3132 3
            $RENAVAM,
3133 3
            false,
3134 1
            $identificador . 'RENAVAM do veículo'
3135 2
        );
3136 3
        $this->dom->addChild(
3137 3
            $this->veic[$posicao],
3138 3
            'placa',
3139 3
            $placa,
3140 3
            false,
3141 1
            $identificador . 'Placa do veículo'
3142 2
        );
3143 3
        $this->dom->addChild(
3144 3
            $this->veic[$posicao],
3145 3
            'tara',
3146 3
            $tara,
3147 3
            false,
3148 1
            $identificador . 'Tara em KG'
3149 2
        );
3150 3
        $this->dom->addChild(
3151 3
            $this->veic[$posicao],
3152 3
            'capKG',
3153 3
            $capKG,
3154 3
            false,
3155 1
            $identificador . 'Capacidade em KG'
3156 2
        );
3157 3
        $this->dom->addChild(
3158 3
            $this->veic[$posicao],
3159 3
            'capM3',
3160 3
            $capM3,
3161 3
            false,
3162 1
            $identificador . 'Capacidade em M3'
3163 2
        );
3164 3
        $this->dom->addChild(
3165 3
            $this->veic[$posicao],
3166 3
            'tpProp',
3167 3
            $tpProp,
3168 3
            false,
3169 1
            $identificador . 'Tipo de Propriedade de veículo'
3170 2
        );
3171 3
        $this->dom->addChild(
3172 3
            $this->veic[$posicao],
3173 3
            'tpVeic',
3174 3
            $tpVeic,
3175 3
            false,
3176 1
            $identificador . 'Tipo do veículo'
3177 2
        );
3178 3
        $this->dom->addChild(
3179 3
            $this->veic[$posicao],
3180 3
            'tpRod',
3181 3
            $tpRod,
3182 3
            false,
3183 1
            $identificador . 'Tipo do Rodado'
3184 2
        );
3185 3
        $this->dom->addChild(
3186 3
            $this->veic[$posicao],
3187 3
            'tpCar',
3188 3
            $tpCar,
3189 3
            false,
3190 1
            $identificador . 'Tipo de Carroceria'
3191 2
        );
3192 3
        $this->dom->addChild(
3193 3
            $this->veic[$posicao],
3194 3
            'UF',
3195 3
            $UF,
3196 3
            false,
3197 1
            $identificador . 'UF em que veículo está licenciado'
3198 2
        );
3199 3
        if ($tpProp == 'T') { // CASO FOR VEICULO DE TERCEIRO
3200
            $this->prop[] = $this->dom->createElement('prop');
3201
            $p = (integer)count($this->prop) - 1;
3202
            if ($CNPJ != '') {
3203
                $this->dom->addChild(
3204
                    $this->prop[$p],
3205
                    'CNPJ',
3206
                    $CNPJ,
3207
                    true,
3208
                    $identificador . 'CNPJ do proprietario'
3209
                );
3210
            } elseif ($CPF != '') {
3211
                $this->dom->addChild(
3212
                    $this->prop[$p],
3213
                    'CPF',
3214
                    $CPF,
3215
                    true,
3216
                    $identificador . 'CPF do proprietario'
3217
                );
3218
            }
3219
            $this->dom->addChild(
3220
                $this->prop[$p],
3221
                'RNTRC',
3222
                $RNTRC,
3223
                true,
3224
                $identificador . 'RNTRC do proprietario'
3225
            );
3226
            $this->dom->addChild(
3227
                $this->prop[$p],
3228
                'xNome',
3229
                $xNome,
3230
                true,
3231
                $identificador . 'Nome do proprietario'
3232
            );
3233
            $this->dom->addChild(
3234
                $this->prop[$p],
3235
                'IE',
3236
                $IE,
3237
                true,
3238
                $identificador . 'IE do proprietario'
3239
            );
3240
            $this->dom->addChild(
3241
                $this->prop[$p],
3242
                'UF',
3243
                $propUF,
3244
                true,
3245
                $identificador . 'UF do proprietario'
3246
            );
3247
            $this->dom->addChild(
3248
                $this->prop[$p],
3249
                'tpProp',
3250
                $tpPropProp,
3251
                true,
3252
                $identificador . 'Tipo Proprietário'
3253
            );
3254
            $this->dom->appChild($this->veic[$posicao], $this->prop[$p], 'Falta tag "prop"');
3255
        }
3256 3
        return $this->veic[$posicao];
3257
    }
3258
3259
3260
    /**
3261
     * Leiaute - Rodoviário
3262
     * Gera as tags para o elemento: "moto" (Informações do(s) Motorista(s))
3263
     * #43
3264
     * Nível: 1
3265
     * @param string $xNome
3266
     * @param string $CPF
3267
     * @return mixed
3268
     */
3269 3 View Code Duplication
    public function motoTag($xNome = '', $CPF = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3270
    {
3271 3
        $identificador = '#43 <moto> - ';
3272 3
        $this->moto[] = $this->dom->createElement('moto');
3273 3
        $posicao = (integer)count($this->moto) - 1;
3274 3
        $this->dom->addChild(
3275 3
            $this->moto[$posicao],
3276 3
            'xNome',
3277 3
            $xNome,
3278 3
            false,
3279 1
            $identificador . 'Nome do motorista'
3280 2
        );
3281 3
        $this->dom->addChild(
3282 3
            $this->moto[$posicao],
3283 3
            'CPF',
3284 3
            $CPF,
3285 3
            false,
3286 1
            $identificador . 'CPF do motorista'
3287 2
        );
3288 3
        return $this->moto[$posicao];
3289
    }
3290
3291
    /**
3292
     * Gera as tags para o elemento: "infCteComp" (Detalhamento do CT-e complementado)
3293
     * #410
3294
     * Nível: 1
3295
     * @param string $chave
3296
     * @return DOMElement|\DOMNode
3297
     */
3298
    public function infCTeComp($chave = '')
3299
    {
3300
        $identificador = '#410 <infCteComp> - ';
3301
        $this->infCteComp = $this->dom->createElement('infCteComp');
3302
        $this->dom->addChild(
3303
            $this->infCteComp,
3304
            'chave',
3305
            $chave,
3306
            true,
3307
            $identificador . ' Chave do CT-e complementado'
3308
        );
3309
        return $this->infCteComp;
3310
    }
3311
3312
    /**
3313
     * Gera as tags para o elemento: "infCteAnu" (Detalhamento do CT-e de Anulação)
3314
     * #411
3315
     * Nível: 1
3316
     * @param string $chave
3317
     * @param string $data
3318
     * @return DOMElement|\DOMNode
3319
     */
3320 View Code Duplication
    public function infCteAnuTag($chave = '', $data = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3321
    {
3322
        $identificador = '#411 <infCteAnu> - ';
3323
        $this->infCteAnu = $this->dom->createElement('infCteAnu');
3324
        $this->dom->addChild(
3325
            $this->infCteAnu,
3326
            'chCte',
3327
            $chave,
3328
            true,
3329
            $identificador . ' Chave do CT-e anulado'
3330
        );
3331
        $this->dom->addChild(
3332
            $this->infCteAnu,
3333
            'dEmi',
3334
            $data,
3335
            true,
3336
            $identificador . ' Data de Emissão do CT-e anulado'
3337
        );
3338
        return $this->infCteAnu;
3339
    }
3340
}
3341