Passed
Push — master ( 18e2e8...ca323f )
by Roberto
02:38 queued 01:35
created

src/Factories/Parser.php (15 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace NFePHP\NFe\Factories;
4
5
/**
6
 * Classe de conversão do TXT para XML
7
 * NOTA: ajustado para Nota Técnica 2018.005 Versão 1.00 – Dezembro de 2018
8
 * @category  API
9
 * @package   NFePHP\NFe
10
 * @copyright NFePHP Copyright (c) 2008-2019
11
 * @license   http://www.gnu.org/licenses/lgpl.txt LGPLv3+
12
 * @license   https://opensource.org/licenses/MIT MIT
13
 * @license   http://www.gnu.org/licenses/gpl.txt GPLv3+
14
 * @author    Roberto L. Machado <linux.rlm at gmail dot com>
15
 * @link      http://github.com/nfephp-org/sped-nfe for the canonical source repository
16
 */
17
18
use NFePHP\NFe\Make;
19
use NFePHP\NFe\Exception\DocumentsException;
20
use stdClass;
21
22
class Parser
23
{
24
    const LOCAL = "LOCAL";
25
    const LOCAL_V12 = "LOCAL_V12";
26
    const SEBRAE = "SEBRAE";
27
28
    /**
29
     * @var array
30
     */
31
    protected $structure;
32
    /**
33
     * @var Make
34
     */
35
    protected $make;
36
    /**
37
     * @var int
38
     */
39
    protected $item = 0;
40
    /**
41
     * @var int
42
     */
43
    protected $nDI = 0;
44
    /**
45
     * @var int
46
     */
47
    protected $volId = -1;
48
    /**
49
     * @var stdClass|null
50
     */
51
    protected $stdNFP;
52
    /**
53
     * @var stdClass|null
54
     */
55
    protected $stdEmit;
56
    /**
57
     * @var stdClass|null
58
     */
59
    protected $stdDest;
60
    /**
61
     * @var stdClass|null
62
     */
63
    protected $stdRetirada;
64
    /**
65
     * @var stdClass|null
66
     */
67
    protected $stdEntrega;
68
    /**
69
     * @var stdClass|null
70
     */
71
    protected $stdAutXML;
72
    /**
73
     * @var stdClass
74
     */
75
    protected $stdComb;
76
    /**
77
     * @var stdClass
78
     */
79
    protected $stdIPI;
80
    /**
81
     * @var stdClass
82
     */
83
    protected $stdPIS;
84
    /**
85
     * @var stdClass
86
     */
87
    protected $stdPISST;
88
    /**
89
     * @var stdClass
90
     */
91
    protected $stdII;
92
    /**
93
     * @var stdClass
94
     */
95
    protected $stdCOFINS;
96
    /**
97
     * @var stdClass
98
     */
99
    protected $stdCOFINSST;
100
    /**
101
     * @var stdClass|null
102
     */
103
    protected $stdTransporta;
104
    /**
105
     * @var string
106
     */
107
    protected $baselayout;
108
109
    /**
110
     * Configure environment to correct NFe layout
111
     * @param string $version
112
     * @param string $baselayout
113
     */
114
    public function __construct($version = '4.00', $baselayout = self::LOCAL)
115
    {
116
        $ver = str_replace('.', '', $version);
117
        $comp = "";
118
        if ($baselayout === 'SEBRAE') {
119
            $comp = "_sebrae";
120
        } elseif ($baselayout == 'LOCAL_V12') {
121
            $comp = "_v1.2";
122
        }
123
        $this->baselayout = $baselayout;
124
        $path = realpath(__DIR__."/../../storage/txtstructure$ver" . $comp . ".json");
125
        $this->structure = json_decode(file_get_contents($path), true);
126
        $this->make = new Make();
127
    }
128
129
    /**
130
     * Convert txt to XML
131
     * @param array $nota
132
     * @return string|null
133
     */
134
    public function toXml($nota)
135
    {
136
        $this->array2xml($nota);
137
        if ($this->make->monta()) {
138
            return $this->make->getXML();
139
        }
140
        return null;
141
    }
142
143
    /**
144
     * Retorna erros na criacao do DOM
145
     * @return array
146
     */
147
    public function getErrors()
148
    {
149
        return $this->make->errors;
150
    }
151
152
    /**
153
     * Converte txt array to xml
154
     * @param array $nota
155
     * @return void
156
     */
157
    protected function array2xml($nota)
158
    {
159
        foreach ($nota as $lin) {
160
            $fields = explode('|', $lin);
161
            if (empty($fields)) {
162
                continue;
163
            }
164
            $metodo = strtolower(str_replace(' ', '', $fields[0])).'Entity';
165
            if (!method_exists(__CLASS__, $metodo)) {
166
                throw DocumentsException::wrongDocument(16, $lin); //campo não definido
167
            }
168
            $struct = $this->structure[strtoupper($fields[0])];
169
            $std = $this->fieldsToStd($fields, $struct);
170
            $this->$metodo($std);
171
        }
172
    }
173
174
    /**
175
     * Creates stdClass for all tag fields
176
     * @param array $dfls
177
     * @param string $struct
178
     * @return stdClass
179
     */
180
    protected static function fieldsToStd($dfls, $struct)
181
    {
182
        $sfls = explode('|', $struct);
183
        $len = count($sfls)-1;
184
        $std = new \stdClass();
185
        for ($i = 1; $i < $len; $i++) {
186
            $name = $sfls[$i];
187
            $data = $dfls[$i];
188
            if (!empty($name) && $data !== '') {
189
                $std->$name = $data;
190
            }
191
        }
192
        return $std;
193
    }
194
195
    /**
196
     * Create tag infNFe [A]
197
     * A|versao|Id|pk_nItem|
198
     * @param stdClass $std
199
     * @return void
200
     */
201
    protected function aEntity($std)
202
    {
203
        $this->make->taginfNFe($std);
204
    }
205
206
    /**
207
     * Create tag ide [B]
208
     * B|cUF|cNF|natOp|mod|serie|nNF|dhEmi|dhSaiEnt|tpNF|idDest|cMunFG|tpImp
209
     *  |tpEmis|cDV|tpAmb|finNFe|indFinal|indPres|procEmi|verProc|dhCont|xJust|
210
     * @param stdClass $std
211
     * @return void
212
     */
213
    protected function bEntity($std)
214
    {
215
        $this->make->tagide($std);
216
    }
217
218
    /**
219
     * Create tag nfref [BA]
220
     * BA|
221
     * @param stdClass $std
222
     * @return void
223
     */
224
    protected function baEntity($std)
0 ignored issues
show
The parameter $std is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
225
    {
226
        //fake não faz nada
227
        $field = null;
0 ignored issues
show
$field 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...
228
    }
229
230
    /**
231
     * Create tag refNFe [BA02]
232
     * BA02|refNFe|
233
     * @param stdClass $std
234
     * @return void
235
     */
236
    protected function ba02Entity($std)
237
    {
238
        $this->make->tagrefNFe($std);
239
    }
240
241
    /**
242
     * Create tag refNF [BA03]
243
     * BA03|cUF|AAMM|CNPJ|mod|serie|nNF|
244
     * @param stdClass $std
245
     * @return void
246
     */
247
    protected function ba03Entity($std)
248
    {
249
        $this->make->tagrefNF($std);
250
    }
251
252
    /**
253
     * Load fields for tag refNFP [BA10]
254
     * BA10|cUF|AAMM|IE|mod|serie|nNF|
255
     * @param stdClass $std
256
     * @return void
257
     */
258
    protected function ba10Entity($std)
259
    {
260
        $this->stdNFP = $std;
261
        $this->stdNFP->CNPJ = null;
262
        $this->stdNFP->CPF = null;
263
    }
264
265
    /**
266
     * Create tag refNFP [BA13], with CNPJ belongs to [BA10]
267
     * BA13|CNPJ|
268
     * @param stdClass $std
269
     * @return void
270
     */
271
    protected function ba13Entity($std)
272
    {
273
        $this->stdNFP->CNPJ = $std->CNPJ;
274
        $this->buildBA10Entity();
275
        $this->stdNFP = null;
276
    }
277
278
    /**
279
     * Create tag refNFP [BA14], with CPF belongs to [BA10]
280
     * BA14|CPF|
281
     * @param stdClass $std
282
     * @return void
283
     */
284
    protected function ba14Entity($std)
285
    {
286
        $this->stdNFP->CPF = $std->CPF;
287
        $this->buildBA10Entity();
288
        $this->stdNFP = null;
289
    }
290
291
    /**
292
     * Create tag refNFP [BA10]
293
     * @return void
294
     */
295
    protected function buildBA10Entity()
296
    {
297
        $this->make->tagrefNFP($this->stdNFP);
0 ignored issues
show
It seems like $this->stdNFP can be null; however, tagrefNFP() does not accept null, maybe add an additional type check?

Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code:

/** @return stdClass|null */
function mayReturnNull() { }

function doesNotAcceptNull(stdClass $x) { }

// With potential error.
function withoutCheck() {
    $x = mayReturnNull();
    doesNotAcceptNull($x); // Potential error here.
}

// Safe - Alternative 1
function withCheck1() {
    $x = mayReturnNull();
    if ( ! $x instanceof stdClass) {
        throw new \LogicException('$x must be defined.');
    }
    doesNotAcceptNull($x);
}

// Safe - Alternative 2
function withCheck2() {
    $x = mayReturnNull();
    if ($x instanceof stdClass) {
        doesNotAcceptNull($x);
    }
}
Loading history...
298
    }
299
300
    /**
301
     * Create tag refCTe [BA19]
302
     * B19|refCTe|
303
     * @param stdClass $std
304
     * @return void
305
     */
306
    protected function ba19Entity($std)
307
    {
308
        $this->make->tagrefCTe($std);
309
    }
310
311
    /**
312
     * Create tag refECF [BA20]
313
     * BA20|mod|nECF|nCOO|
314
     * @param stdClass $std
315
     * @return void
316
     */
317
    protected function ba20Entity($std)
318
    {
319
        $this->make->tagrefECF($std);
320
    }
321
322
    /**
323
     * Load fields for tag emit [C]
324
     * C|XNome|XFant|IE|IEST|IM|CNAE|CRT|
325
     * @param stdClass $std
326
     * @return void
327
     */
328
    protected function cEntity($std)
329
    {
330
        $this->stdEmit = $std;
331
        $this->stdEmit->CNPJ = null;
332
        $this->stdEmit->CPF = null;
333
    }
334
335
    /**
336
     * Create tag emit [C02], with CNPJ belongs to [C]
337
     * C02|CNPJ|
338
     * @param stdClass $std
339
     * @return void
340
     */
341
    protected function c02Entity($std)
342
    {
343
        $this->stdEmit->CNPJ = $std->CNPJ;
344
        $this->buildCEntity();
345
        $this->stdEmit = null;
346
    }
347
348
    /**
349
     * Create tag emit [C02a], with CPF belongs to [C]
350
     * C02a|CPF|
351
     * @param stdClass $std
352
     * @return void
353
     */
354
    protected function c02aEntity($std)
355
    {
356
        $this->stdEmit->CPF = $std->CPF;
357
        $this->buildCEntity();
358
        $this->stdEmit = null;
359
    }
360
361
    protected function dEntity($std)
0 ignored issues
show
The parameter $std is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
362
    {
363
        //nada
364
    }
365
366
    /**
367
     * Create tag emit [C]
368
     * @return void
369
     */
370
    protected function buildCEntity()
371
    {
372
        $this->make->tagemit($this->stdEmit);
0 ignored issues
show
It seems like $this->stdEmit can be null; however, tagemit() does not accept null, maybe add an additional type check?

Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code:

/** @return stdClass|null */
function mayReturnNull() { }

function doesNotAcceptNull(stdClass $x) { }

// With potential error.
function withoutCheck() {
    $x = mayReturnNull();
    doesNotAcceptNull($x); // Potential error here.
}

// Safe - Alternative 1
function withCheck1() {
    $x = mayReturnNull();
    if ( ! $x instanceof stdClass) {
        throw new \LogicException('$x must be defined.');
    }
    doesNotAcceptNull($x);
}

// Safe - Alternative 2
function withCheck2() {
    $x = mayReturnNull();
    if ($x instanceof stdClass) {
        doesNotAcceptNull($x);
    }
}
Loading history...
373
    }
374
375
    /**
376
     * Create tag enderEmit [C05]
377
     * C05|xLgr|nro|xCpl|xBairro|cMun|xMun|UF|CEP|cPais|xPais|fone|
378
     * @param stdClass $std
379
     * @return void
380
     */
381
    protected function c05Entity($std)
382
    {
383
        $this->make->tagenderEmit($std);
384
    }
385
386
    /**
387
     * Load fields for tag dest [E]
388
     * E|xNome|indIEDest|IE|ISUF|IM|email|
389
     * @param stdClass $std
390
     * @return void
391
     */
392
    protected function eEntity($std)
393
    {
394
        $this->stdDest = $std;
395
        $this->stdDest->CNPJ = null;
396
        $this->stdDest->CPF = null;
397
        $this->stdDest->idEstrangeiro = null;
398
    }
399
400
    /**
401
     * Create tag dest [E02], with CNPJ belongs to [E]
402
     * E02|CNPJ|
403
     * @param stdClass $std
404
     * @return void
405
     */
406
    protected function e02Entity($std)
407
    {
408
        $this->stdDest->CNPJ = $std->CNPJ;
409
        $this->buildEEntity();
410
        $this->stdDest = null;
411
    }
412
413
    /**
414
     * Create tag dest [E03], with CPF belongs to [E]
415
     * E03|CPF|
416
     * @param stdClass $std
417
     * @return void
418
     */
419
    protected function e03Entity($std)
420
    {
421
        $this->stdDest->CPF = $std->CPF;
422
        $this->buildEEntity();
423
        $this->stdDest = null;
424
    }
425
426
    /**
427
     * Create tag dest [E03a], with idEstrangeiro belongs to [E]
428
     * E03a|idEstrangeiro|
429
     * @param stdClass $std
430
     * @return void
431
     */
432
    protected function e03aEntity($std)
433
    {
434
        $this->stdDest->idEstrangeiro = !empty($std->idEstrangeiro) ? $std->idEstrangeiro : '';
435
        $this->buildEEntity();
436
        $this->stdDest = null;
437
    }
438
439
    /**
440
     * Create tag dest [E]
441
     * @return void
442
     */
443
    protected function buildEEntity()
444
    {
445
        $this->make->tagdest($this->stdDest);
0 ignored issues
show
It seems like $this->stdDest can be null; however, tagdest() does not accept null, maybe add an additional type check?

Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code:

/** @return stdClass|null */
function mayReturnNull() { }

function doesNotAcceptNull(stdClass $x) { }

// With potential error.
function withoutCheck() {
    $x = mayReturnNull();
    doesNotAcceptNull($x); // Potential error here.
}

// Safe - Alternative 1
function withCheck1() {
    $x = mayReturnNull();
    if ( ! $x instanceof stdClass) {
        throw new \LogicException('$x must be defined.');
    }
    doesNotAcceptNull($x);
}

// Safe - Alternative 2
function withCheck2() {
    $x = mayReturnNull();
    if ($x instanceof stdClass) {
        doesNotAcceptNull($x);
    }
}
Loading history...
446
    }
447
448
    /**
449
     * Create tag enderDest [E05]
450
     * E05|xLgr|nro|xCpl|xBairro|cMun|xMun|UF|CEP|cPais|xPais|fone|
451
     * @param stdClass $std
452
     * @return void
453
     */
454
    protected function e05Entity($std)
455
    {
456
        $this->make->tagenderDest($std);
457
    }
458
459
    /**
460
     * Load fields for tag retirada [F]
461
     * F|xLgr|nro|xCpl|xBairro|cMun|xMun|UF|CEP|cPais|xPais|fone|email|IE|
462
     * @param stdClass $std
463
     * @return void
464
     */
465
    protected function fEntity($std)
466
    {
467
        $this->stdRetirada = null;
468
        $this->stdRetirada = $std;
469
        $this->stdRetirada->CNPJ = null;
470
        $this->stdRetirada->CPF = null;
471
        $this->stdRetirada->xNome = null;
472
    }
473
474
    /**
475
     * Create tag retirada [F02], with CNPJ belongs to [F]
476
     * F02|CNPJ|
477
     * @param stdClass $std
478
     * @return void
479
     */
480
    protected function f02Entity($std)
481
    {
482
        $this->stdRetirada->CNPJ = $std->CNPJ;
483
        $this->buildFEntity();
484
    }
485
486
    /**
487
     * Create tag retirada [F02a], with CPF belongs to [F]
488
     * F02a|CPF|
489
     * @param stdClass $std
490
     * @return void
491
     */
492
    protected function f02aEntity($std)
493
    {
494
        $this->stdRetirada->CPF = $std->CPF;
495
        $this->buildFEntity();
496
    }
497
    
498
    /**
499
     * Create tag retirada [F02b], with xNome belongs to [F]
500
     * F02a|xNome|
501
     * @param stdClass $std
502
     * @return void
503
     */
504
    protected function f02bEntity($std)
505
    {
506
        $this->stdRetirada->xNome = $std->xNome;
507
        $this->buildFEntity();
508
    }
509
510
    /**
511
     * Create tag retirada [F]
512
     * @return void
513
     */
514
    protected function buildFEntity()
515
    {
516
        $this->make->tagretirada($this->stdRetirada);
0 ignored issues
show
It seems like $this->stdRetirada can be null; however, tagretirada() does not accept null, maybe add an additional type check?

Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code:

/** @return stdClass|null */
function mayReturnNull() { }

function doesNotAcceptNull(stdClass $x) { }

// With potential error.
function withoutCheck() {
    $x = mayReturnNull();
    doesNotAcceptNull($x); // Potential error here.
}

// Safe - Alternative 1
function withCheck1() {
    $x = mayReturnNull();
    if ( ! $x instanceof stdClass) {
        throw new \LogicException('$x must be defined.');
    }
    doesNotAcceptNull($x);
}

// Safe - Alternative 2
function withCheck2() {
    $x = mayReturnNull();
    if ($x instanceof stdClass) {
        doesNotAcceptNull($x);
    }
}
Loading history...
517
    }
518
519
    /**
520
     * Load fields for tag entrega [G]
521
     * G|xLgr|nro|xCpl|xBairro|cMun|xMun|UF|CEP|cPais|xPais|fone|email|IE|
522
     * @param stdClass $std
523
     * @return void
524
     */
525
    protected function gEntity($std)
526
    {
527
        $this->stdEntrega = null;
528
        $this->stdEntrega = $std;
529
        $this->stdEntrega->CNPJ = null;
530
        $this->stdEntrega->CPF = null;
531
        $this->stdEntrega->xNome = null;
532
    }
533
534
    /**
535
     * Create tag entrega [G02], with CNPJ belongs to [G]
536
     * G02|CNPJ|
537
     * @param stdClass $std
538
     * @return void
539
     */
540
    protected function g02Entity($std)
541
    {
542
        $this->stdEntrega->CNPJ = $std->CNPJ;
543
        $this->buildGEntity();
544
    }
545
546
    /**
547
     * Create tag entrega [G02a], with CPF belongs to [G]
548
     * G02a|CPF|
549
     * @param stdClass $std
550
     * @return void
551
     */
552
    protected function g02aEntity($std)
553
    {
554
        $this->stdEntrega->CPF = $std->CPF;
555
        $this->buildGEntity();
556
    }
557
    
558
    /**
559
     * Create tag entrega [G02b], with xNome belongs to [G]
560
     * G02b|xNome|
561
     * @param stdClass $std
562
     * @return void
563
     */
564
    protected function g02bEntity($std)
565
    {
566
        $this->stdEntrega->xNome = $std->xNome;
567
        $this->buildGEntity();
568
    }
569
    
570
571
    /**
572
     * Create tag entrega [G]
573
     * @return void
574
     */
575
    protected function buildGEntity()
576
    {
577
        $this->make->tagentrega($this->stdEntrega);
0 ignored issues
show
It seems like $this->stdEntrega can be null; however, tagentrega() does not accept null, maybe add an additional type check?

Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code:

/** @return stdClass|null */
function mayReturnNull() { }

function doesNotAcceptNull(stdClass $x) { }

// With potential error.
function withoutCheck() {
    $x = mayReturnNull();
    doesNotAcceptNull($x); // Potential error here.
}

// Safe - Alternative 1
function withCheck1() {
    $x = mayReturnNull();
    if ( ! $x instanceof stdClass) {
        throw new \LogicException('$x must be defined.');
    }
    doesNotAcceptNull($x);
}

// Safe - Alternative 2
function withCheck2() {
    $x = mayReturnNull();
    if ($x instanceof stdClass) {
        doesNotAcceptNull($x);
    }
}
Loading history...
578
    }
579
580
    /**
581
     * Create tag autXML [GA]
582
     * GA|
583
     * @param stdClass $std
584
     * @return void
585
     */
586
    protected function gaEntity($std)
587
    {
588
        //fake não faz nada
589
        $std->CNPJ = null;
590
        $std->CPF = null;
591
        $this->stdAutXML = $std;
592
    }
593
594
    /**
595
     * Create tag autXML with CNPJ [GA02], belongs to [GA]
596
     * GA02|CNPJ|
597
     * @param stdClass $std
598
     * @return void
599
     */
600
    protected function ga02Entity($std)
601
    {
602
        $this->stdAutXML->CNPJ = $std->CNPJ;
603
        $this->make->tagautXML($this->stdAutXML);
604
        $this->stdAutXML = null;
605
    }
606
607
    /**
608
     * Create tag autXML with CPF [GA03], belongs to GA
609
     * GA03|CPF|
610
     * @param stdClass $std
611
     * @return void
612
     */
613
    protected function ga03Entity($std)
614
    {
615
        $this->stdAutXML->CPF = $std->CPF;
616
        $this->make->tagautXML($this->stdAutXML);
617
        $this->stdAutXML = null;
618
    }
619
620
    /**
621
     * Create tag det/infAdProd [H]
622
     * H|item|infAdProd|
623
     * @param stdClass $std
624
     */
625
    protected function hEntity($std)
626
    {
627
        if (!empty($std->infAdProd)) {
628
            $this->make->taginfAdProd($std);
629
        }
630
        $this->item = (integer) $std->item;
631
    }
632
633
    /**
634
     * Create tag prod [I]
635
     * LOCAL
636
     * I|cProd|cEAN|xProd|NCM|cBenef|EXTIPI|CFOP|uCom|qCom|vUnCom|vProd|cEANTrib|uTrib|qTrib|vUnTrib|vFrete|vSeg|vDesc|vOutro|indTot|xPed|nItemPed|nFCI|
637
     * SEBRAE
638
     * I|cProd|cEAN|xProd|NCM|EXTIPI|CFOP|uCom|qCom|vUnCom|vProd|cEANTrib|uTrib|qTrib|vUnTrib|vFrete|vSeg|vDesc|vOutro|indTot|xPed|nItemPed|nFCI|
639
     * @param stdClass $std
640
     * @return void
641
     */
642
    protected function iEntity($std)
643
    {
644
        $std->item = $this->item;
645
        $this->make->tagprod($std);
646
    }
647
648
    /**
649
     * Create tag NVE [I05A]
650
     * I05A|NVE|
651
     * @param stdClass $std
652
     * @return void
653
     */
654
    protected function i05aEntity($std)
655
    {
656
        $std->item = $this->item;
657
        $this->make->tagNVE($std);
658
    }
659
660
    /**
661
     * Create tag CEST [I05C]
662
     * I05C|CEST|indEscala|CNPJFab|
663
     * SEBRAE
664
     * I05C|CEST|indEscala|CNPJFab|cBenef|
665
     * @param stdClass $std
666
     * @return void
667
     */
668
    protected function i05cEntity($std)
669
    {
670
        $std->item = $this->item;
671
        $this->make->tagCEST($std);
672
    }
673
674
    /**
675
     * Create tag DI [I18]
676
     * I18|nDI|dDI|xLocDesemb|UFDesemb|dDesemb|tpViaTransp|vAFRMM|tpIntermedio|CNPJ|UFTerceiro|cExportador|
677
     * @param stdClass $std
678
     * @return void
679
     */
680
    protected function i18Entity($std)
681
    {
682
        $std->item = $this->item;
683
        $this->make->tagDI($std);
684
        $this->nDI = $std->nDI;
685
    }
686
687
    /**
688
     * Create tag adi [I25], belongs to [I18]
689
     * I25|nAdicao|nSeqAdicC|cFabricante|vDescDI|nDraw|
690
     * @param stdClass $std
691
     * @return void
692
     */
693
    protected function i25Entity($std)
694
    {
695
        $std->item = $this->item;
696
        $std->nDI = $this->nDI;
697
        $this->make->tagadi($std);
698
    }
699
700
    /**
701
     * Load fields for tag detExport [I50]
702
     * I50|nDraw|
703
     * @param stdClass $std
704
     * @return void
705
     */
706
    protected function i50Entity($std)
707
    {
708
        $std->item = $this->item;
709
        $this->make->tagdetExport($std);
710
    }
711
712
    /**
713
     * Create tag detExport/exportInd [I52], belongs to [I50]
714
     * I52|nRE|chNFe|qExport|
715
     * @param stdClass $std
716
     * @return void
717
     */
718
    protected function i52Entity($std)
719
    {
720
        $std->item = $this->item;
721
        $this->make->tagdetExportInd($std);
722
    }
723
724
    /**
725
     * Create tag RASTRO [I80]
726
     * I80|nLote|qLote|dFab|dVal|cAgreg|
727
     * @param stdClass $std
728
     * @return void
729
     */
730
    protected function i80Entity($std)
731
    {
732
        $std->item = $this->item;
733
        $this->make->tagRastro($std);
734
    }
735
736
    /**
737
     * Create tag veicProd [JA]
738
     * JA|tpOp|chassi|cCor|xCor|pot|cilin|pesoL|pesoB|nSerie|tpComb|nMotor|CMT|dist|anoMod|anoFab|tpPint|tpVeic|espVeic|VIN|condVeic|cMod|cCorDENATRAN|lota|tpRest|
739
     * @param stdClass $std
740
     * @return void
741
     */
742
    protected function jaEntity($std)
743
    {
744
        $std->item = $this->item;
745
        $this->make->tagveicProd($std);
746
    }
747
748
    /**
749
     * Create tag med [K]
750
     * K|cProdANVISA|vPMC|xMotivoIsencao|
751
     * @param stdClass $std
752
     * @return void
753
     */
754
    protected function kEntity($std)
755
    {
756
        $std->item = $this->item;
757
        $std->nLote = !empty($std->nLote) ? $std->nLote : null;
758
        $std->qLote = !empty($std->qLote) ? $std->qLote : null;
759
        $std->dFab = !empty($std->dFab) ? $std->dFab : null;
760
        $std->dVal = !empty($std->dVal) ? $std->dVal : null;
761
        $std->cProdANVISA = !empty($std->cProdANVISA) ? $std->cProdANVISA : null;
762
        $std->xMotivoIsencao = !empty($std->xMotivoIsencao) ? $std->xMotivoIsencao : null;
763
        $this->make->tagmed($std);
764
    }
765
766
    /**
767
     * Create tag arma [L]
768
     * L|tpArma|nSerie|nCano|descr|
769
     * @param stdClass $std
770
     * @return void
771
     */
772
    protected function lEntity($std)
773
    {
774
        $std->item = $this->item;
775
        $this->make->tagarma($std);
776
    }
777
778
    /**
779
     * Load fields for tag comb [LA]
780
     * LA|cProdANP|descANP|pGLP|pGNn|pGNi|vPart|CODIF|qTemp|UFCons|
781
     * @param stdClass $std
782
     * @return void
783
     */
784
    protected function laEntity($std)
785
    {
786
        $std->item = $this->item;
787
        $this->stdComb = $std;
788
    }
789
790
    /**
791
     * Load fields for tag comb [LA07], belongs to [LA]
792
     * LA07|qBCProd|vAliqProd|vCIDE|
793
     * @param stdClass $std
794
     * @return void
795
     */
796
    protected function la07Entity($std)
797
    {
798
        $this->stdComb->qBCProd = $std->qBCProd;
799
        $this->stdComb->vAliqProd = $std->vAliqProd;
800
        $this->stdComb->vCIDE = $std->vCIDE;
801
    }
802
803
    /**
804
     * Load fields for tag encerrante [LA11]
805
     * LA11|nBico|nBomba|nTanque|vEncIni|vEncFin|
806
     * @param stdClass $std
807
     * @return void
808
     */
809
    protected function la11Entity($std)
810
    {
811
        $std->item = $this->item;
812
        $this->make->tagencerrante($std);
813
    }
814
815
    /**
816
     * Create tag comb [LA]
817
     * @return void
818
     */
819
    protected function buildLAEntity()
820
    {
821
        if (!empty($this->stdComb)) {
822
            $this->make->tagcomb($this->stdComb);
823
        }
824
    }
825
826
    /**
827
     * Create tag RECOPI [LB]
828
     * LB|nRECOPI|
829
     * @param stdClass $std
830
     * @return void
831
     */
832
    protected function lbEntity($std)
833
    {
834
        $std->item = $this->item;
835
        $this->make->tagRECOPI($std);
836
    }
837
838
    /**
839
     * Create tag imposto [M]
840
     * M|vTotTrib|
841
     * @param stdClass $std
842
     * @return void
843
     */
844
    protected function mEntity($std)
845
    {
846
        //create tag comb [LA]
847
        $this->buildLAEntity();
848
849
        $std->item = $this->item;
850
        $this->make->tagimposto($std);
851
    }
852
853
    /**
854
     * Carrega a tag ICMS [N]
855
     * N|
856
     * @param stdClass $std
857
     * @return void
858
     */
859
    protected function nEntity($std)
0 ignored issues
show
The parameter $std is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
860
    {
861
        //fake não faz nada
862
        $field = null;
0 ignored issues
show
$field 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...
863
    }
864
865
    /**
866
     * Load fields for tag ICMS [N02]
867
     * N02|orig|CST|modBC|vBC|pICMS|vICMS|pFCP|vFCP|
868
     * @param stdClass $std
869
     * @return void
870
     */
871
    protected function n02Entity($std)
872
    {
873
        $this->buildNEntity($std);
874
    }
875
876
    /**
877
     * Load fields for tag ICMS [N03]
878
     * N03|orig|CST|modBC|vBC|pICMS|vICMS|vBCFCP|pFCP|vFCP|modBCST|pMVAST|pRedBCST|vBCST|pICMSST|vICMSST|vBCFCPST|pFCPST|vFCPST|
879
     * @param stdClass $std
880
     * @return void
881
     */
882
    protected function n03Entity($std)
883
    {
884
        $this->buildNEntity($std);
885
    }
886
887
    /**
888
     * Load fields for tag ICMS [N04]
889
     * N04|orig|CST|modBC|pRedBC|vBC|pICMS|vICMS|BCFCP|pFCP|vFCP|vICMSDeson|motDesICMS|
890
     * @param stdClass $std
891
     * @return void
892
     */
893
    protected function n04Entity($std)
894
    {
895
        $this->buildNEntity($std);
896
    }
897
898
    /**
899
     * Load fields for tag ICMS [N05]
900
     * N05|orig|CST|modBCST|pMVAST|pRedBCST|vBCST|pICMSST|vICMSST|vBCFCPST|pFCPST|vFCPST|vICMSDeson|motDesICMS|
901
     * @param stdClass $std
902
     * @return void
903
     */
904
    protected function n05Entity($std)
905
    {
906
        $this->buildNEntity($std);
907
    }
908
909
    /**
910
     * Load fields for tag ICMS [N06]
911
     * N06|orig|CST|vICMSDeson|motDesICMS|
912
     * @param stdClass $std
913
     * @return void
914
     */
915
    protected function n06Entity($std)
916
    {
917
        $this->buildNEntity($std);
918
    }
919
920
    /**
921
     * Load fields for tag ICMS [N07]
922
     * N07|orig|CST|modBC|pRedBC|vBC|pICMS|vICMSOp|pDif|vICMSDif|vICMS|vBCFCP|pFCP|vFCP|
923
     * @param stdClass $std
924
     * @return void
925
     */
926
    protected function n07Entity($std)
927
    {
928
        $this->buildNEntity($std);
929
    }
930
931
    /**
932
     * Load fields for tag ICMS [N08]
933
     * N08|orig|CST|vBCSTRet|pST|vICMSSTRet|vBCFCPSTRet|pFCPSTRet|vFCPSTRet|
934
     * @param stdClass $std
935
     * @return void
936
     */
937
    protected function n08Entity($std)
938
    {
939
        $this->buildNEntity($std);
940
    }
941
942
    /**
943
     * Load fields for tag ICMS [N09]
944
     * N09|orig|CST|modBC|pRedBC|vBC|pICMS|vICMS|vBCFCP|pFCP|vFCP|modBCST|pMVAST|pRedBCST|vBCST|pICMSST|vICMSST|vBCFCPST|pFCPST|vFCPST|vICMSDeson|motDesICMS|
945
     * @param stdClass $std
946
     * @return void
947
     */
948
    protected function n09Entity($std)
949
    {
950
        $this->buildNEntity($std);
951
    }
952
953
    /**
954
     * Load fields for tag ICMS [N10]
955
     * N10|orig|CST|modBC|vBC|pRedBC|pICMS|vICMS|vBCFCP|pFCP|vFCP|modBCST|pMVAST|pRedBCST|vBCST|pICMSST|vICMSST|vBCFCPST|pFCPST|vFCPST|vICMSDeson|motDesICMS|
956
     * @param stdClass $std
957
     * @return void
958
     */
959
    protected function n10Entity($std)
960
    {
961
        $this->buildNEntity($std);
962
    }
963
964
    /**
965
     * Create tag ICMS [N]
966
     * NOTE: adjusted for NT2016_002_v1.30
967
     * @param \stdClass $std
968
     * @return void
969
     */
970
    protected function buildNEntity($std)
971
    {
972
        $std->item = $this->item;
973
        $this->make->tagICMS($std);
974
    }
975
976
    /**
977
     * Create tag ICMSPart [N10a]
978
     * N10a|orig|CST|modBC|vBC|pRedBC|pICMS|vICMS|modBCST|pMVAST|pRedBCST|vBCST|pICMSST|vICMSST|pBCOp|UFST|
979
     * @param stdClass $std
980
     * @return void
981
     */
982
    protected function n10aEntity($std)
983
    {
984
        $std->item = $this->item;
985
        $this->make->tagICMSPart($std);
986
    }
987
988
    /**
989
     * Create tag ICMSST [N10b]
990
     * N10b|orig|CST|vBCSTRet|vICMSSTRet|vBCSTDest|vICMSSTDest|vBCFCPSTRet|pFCPSTRet|vFCPSTRet|
991
     * @param stdClass $std
992
     * @return void
993
     */
994
    protected function n10bEntity($std)
995
    {
996
        $std->item = $this->item;
997
        $this->make->tagICMSST($std);
998
    }
999
1000
    /**
1001
     * Carrega e Create tag ICMSSN [N10c]
1002
     * N10c|orig|CSOSN|pCredSN|vCredICMSSN|
1003
     * @param stdClass $std
1004
     * @return void
1005
     */
1006
    protected function n10cEntity($std)
1007
    {
1008
        $this->buildNSNEntity($std);
1009
    }
1010
1011
    /**
1012
     * Carrega e Create tag ICMSSN [N10d]
1013
     * N10d|orig|CSOSN|
1014
     * @param stdClass $std
1015
     * @return void
1016
     */
1017
    protected function n10dEntity($std)
1018
    {
1019
        $this->buildNSNEntity($std);
1020
    }
1021
1022
1023
    /**
1024
     * Carrega e Create tag ICMSSN [N10e]
1025
     * N10e|orig|CSOSN|modBCST|pMVAST|pRedBCST|vBCST|pICMSST|vICMSST|vBCFCPST|pFCPST|vFCPST|pCredSN|vCredICMSSN|pCredSN|vCredICMSSN|
1026
     * @param stdClass $std
1027
     * @return void
1028
     */
1029
    protected function n10eEntity($std)
1030
    {
1031
        $this->buildNSNEntity($std);
1032
    }
1033
    /**
1034
     * Carrega e Create tag ICMSSN [N10f]
1035
     * N10f|orig|CSOSN|modBCST|pMVAST|pRedBCST|vBCST|pICMSST|vICMSST|vBCFCPST|pFCPST|vFCPST|
1036
     * @param stdClass $std
1037
     * @return void
1038
     */
1039
    protected function n10fEntity($std)
1040
    {
1041
        $this->buildNSNEntity($std);
1042
    }
1043
1044
    /**
1045
     * Carrega e Create tag ICMSSN [N10g]
1046
     * N10g|orig|CSOSN|vBCSTRet|pST|vICMSSTRet|vBCFCPSTRet|pFCPSTRet|vFCPSTRet|
1047
     * @param stdClass $std
1048
     * @return void
1049
     */
1050
    protected function n10gEntity($std)
1051
    {
1052
        $this->buildNSNEntity($std);
1053
    }
1054
1055
    /**
1056
     * Carrega e Create tag ICMSSN [N10h]
1057
     * N10h|orig|CSOSN|modBC|vBC|pRedBC|pICMS|vICMS|modBCST|pMVAST|pRedBCST|vBCST|pICMSST|vICMSST|vBCFCPST|pFCPST|vFCPST|pCredSN|vCredICMSSN|
1058
     * @param stdClass $std
1059
     * @return void
1060
     */
1061
    protected function n10hEntity($std)
1062
    {
1063
        $this->buildNSNEntity($std);
1064
    }
1065
1066
    /**
1067
     * Create tag ICMSSN [NS]
1068
     * Nsn|orig|CSOSN|modBC|vBC|pRedBC|pICMS|vICMS|pCredSN|vCredICMSSN|modBCST|pMVAST|pRedBCST|vBCST|pICMSST|vICMSST|vBCSTRet|vICMSSTRet|vBCFCPST|pFCPST|vFCPST|
1069
     * @param stdClass $std
1070
     * @return void
1071
     */
1072
    protected function buildNSNEntity($std)
1073
    {
1074
        $std->item = $this->item;
1075
        $this->make->tagICMSSN($std);
1076
    }
1077
1078
    /**
1079
     * Load field fot tag ICMSUFDest [NA]
1080
     * NA|vBCUFDest|pFCPUFDest|pICMSUFDest|pICMSInter|pICMSInterPart|vFCPUFDest|vICMSUFDest|vICMSFRemet|
1081
     * @param stdClass $std
1082
     * @return void
1083
     */
1084
    protected function naEntity($std)
1085
    {
1086
        $this->buildNAEntity($std);
1087
    }
1088
1089
    /**
1090
     * Create tag ICMSUFDest [NA]
1091
     * @param stdClass $std
1092
     * @return void
1093
     */
1094
    protected function buildNAEntity($std)
1095
    {
1096
        $std->item = $this->item;
1097
        $this->make->tagICMSUFDest($std);
1098
    }
1099
1100
    /**
1101
     * Load fields for tag IPI [O]
1102
     * O|clEnq|CNPJProd|cSelo|qSelo|cEnq|
1103
     * @param stdClass $std
1104
     * @return void
1105
     */
1106
    protected function oEntity($std)
1107
    {
1108
        $std->item = $this->item;
1109
        $this->stdIPI = $std;
1110
        $this->stdIPI->CST = null;
1111
        $this->stdIPI->vIPI = null;
1112
        $this->stdIPI->vBC = null;
1113
        $this->stdIPI->pIPI = null;
1114
        $this->stdIPI->qUnid = null;
1115
        $this->stdIPI->vUnid = null;
1116
    }
1117
1118
    /**
1119
     * Load fields for tag IPI [O07], belongs to [O]
1120
     * O07|CST|vIPI|
1121
     * @param stdClass $std
1122
     * @return void
1123
     */
1124
    protected function o07Entity($std)
1125
    {
1126
        $this->stdIPI->CST = $std->CST;
1127
        $this->stdIPI->vIPI = $std->vIPI;
1128
    }
1129
1130
    /**
1131
     * Load fields for tag IPI [O08], belongs to [O]
1132
     * O08|CST|
1133
     * @param stdClass $std
1134
     * @return void
1135
     */
1136
    protected function o08Entity($std)
1137
    {
1138
        $this->stdIPI->CST = $std->CST;
1139
        $this->buildOEntity();
1140
    }
1141
1142
    /**
1143
     * Load fields for tag IPI [O10], belongs to [O]
1144
     * O10|vBC|pIPI|
1145
     * @param stdClass $std
1146
     * @return void
1147
     */
1148
    protected function o10Entity($std)
1149
    {
1150
        $this->stdIPI->vBC = $std->vBC;
1151
        $this->stdIPI->pIPI = $std->pIPI;
1152
        $this->buildOEntity();
1153
    }
1154
1155
    /**
1156
     * Load fields for tag IPI [O11], belongs to [O]
1157
     * O11|qUnid|vUnid|
1158
     * @param stdClass $std
1159
     * @return void
1160
     */
1161
    protected function o11Entity($std)
1162
    {
1163
        $this->stdIPI->qUnid = $std->qUnid;
1164
        $this->stdIPI->vUnid = $std->vUnid;
1165
        $this->buildOEntity();
1166
    }
1167
1168
    /**
1169
     * Create tag IPI [O]
1170
     * Oxx|cst|clEnq|cnpjProd|cSelo|qSelo|cEnq|vBC|pIPI|qUnid|vUnid|vIPI|
1171
     * @return void
1172
     */
1173
    protected function buildOEntity()
1174
    {
1175
        $this->make->tagIPI($this->stdIPI);
1176
    }
1177
1178
    /**
1179
     * Create tag II [P]
1180
     * P|vBC|vDespAdu|vII|vIOF|
1181
     * @param stdClass $std
1182
     * @return void
1183
     */
1184
    protected function pEntity($std)
1185
    {
1186
        $std->item = $this->item;
1187
        $this->make->tagII($std);
1188
    }
1189
1190
    /**
1191
     * Load fields for tag PIS [Q]
1192
     * Q|
1193
     * @param stdClass $std
1194
     * @return void
1195
     */
1196
    protected function qEntity($std)
1197
    {
1198
        //carrega numero do item
1199
        $std->item = $this->item;
1200
        $this->stdPIS = $std;
1201
        $this->stdPIS->vBC = null;
1202
        $this->stdPIS->pPIS = null;
1203
        $this->stdPIS->vPIS = null;
1204
        $this->stdPIS->qBCProd = null;
1205
        $this->stdPIS->vAliqProd = null;
1206
    }
1207
1208
    /**
1209
     * Load fields for tag PIS [Q02], belongs to [Q]
1210
     * Q02|CST|vBC|pPIS|vPIS|
1211
     * @param stdClass $std
1212
     * @return void
1213
     */
1214
    protected function q02Entity($std)
1215
    {
1216
        $this->stdPIS->CST = $std->CST;
1217
        $this->stdPIS->vBC = $std->vBC;
1218
        $this->stdPIS->pPIS = $std->pPIS;
1219
        $this->stdPIS->vPIS = $std->vPIS;
1220
        $this->buildQEntity();
1221
    }
1222
1223
    /**
1224
     * Load fields for tag PIS [Q03], belongs to [Q]
1225
     * Q03|CST|qBCProd|vAliqProd|vPIS|
1226
     * @param stdClass $std
1227
     * @return void
1228
     */
1229
    protected function q03Entity($std)
1230
    {
1231
        $this->stdPIS->CST = $std->CST;
1232
        $this->stdPIS->vPIS = $std->vPIS;
1233
        $this->stdPIS->qBCProd = $std->qBCProd;
1234
        $this->stdPIS->vAliqProd  = $std->vAliqProd;
1235
        $this->buildQEntity();
1236
    }
1237
1238
    /**
1239
     * Load fields for tag PIS [Q04], belongs to [Q]
1240
     * Q04|CST|
1241
     * @param stdClass $std
1242
     * @return void
1243
     */
1244
    protected function q04Entity($std)
1245
    {
1246
        $this->stdPIS->CST = $std->CST;
1247
        $this->buildQEntity();
1248
    }
1249
1250
    /**
1251
     * Load fields for tag PIS [Q05], belongs to [Q]
1252
     * Q05|CST|vPIS|
1253
     * @param stdClass $std
1254
     * @return void
1255
     */
1256
    protected function q05Entity($std)
1257
    {
1258
        $this->stdPIS->CST = $std->CST;
1259
        $this->stdPIS->vPIS = $std->vPIS;
1260
        $this->buildQEntity();
1261
    }
1262
1263
    /**
1264
     * Load fields for tag PIS [Q07], belongs to [Q]
1265
     * Q07|vBC|pPIS|
1266
     * @param stdClass $std
1267
     * @return void
1268
     */
1269
    protected function q07Entity($std)
1270
    {
1271
        $this->stdPIS->vBC = $std->vBC;
1272
        $this->stdPIS->pPIS = $std->pPIS;
1273
        $this->buildQEntity();
1274
    }
1275
1276
    /**
1277
     * Load fields for tag PIS [Q10], belongs to [Q]
1278
     * Q10|qBCProd|vAliqProd|
1279
     * @param stdClass $std
1280
     * @return void
1281
     */
1282
    protected function q10Entity($std)
1283
    {
1284
        $this->stdPIS->qBCProd = $std->qBCProd;
1285
        $this->stdPIS->vAliqProd  = $std->vAliqProd;
1286
        $this->buildQEntity();
1287
    }
1288
1289
    /**
1290
     * Create tag PIS [Q]
1291
     * Qxx|CST|vBC|pPIS|vPIS|qBCProd|vAliqProd|
1292
     * @return void
1293
     */
1294
    protected function buildQEntity()
1295
    {
1296
        $this->make->tagPIS($this->stdPIS);
1297
    }
1298
1299
    /**
1300
     * Load fields for tag PISST [R]
1301
     * R|vPIS|
1302
     * @param stdClass $std
1303
     * @return void
1304
     */
1305
    protected function rEntity($std)
1306
    {
1307
        //carrega numero do item
1308
        $std->item = $this->item;
1309
        $this->stdPISST = $std;
1310
        $this->stdPISST->vBC = null;
1311
        $this->stdPISST->pPIS = null;
1312
        $this->stdPISST->vPIS = null;
1313
        $this->stdPISST->qBCProd = null;
1314
        $this->stdPISST->vAliqProd = null;
1315
    }
1316
1317
    /**
1318
     * Load fields for tag PISST [R02], belongs to [R]
1319
     * R02|vBC|pPIS|
1320
     * @param stdClass $std
1321
     * @return void
1322
     */
1323
    protected function r02Entity($std)
1324
    {
1325
        $this->stdPISST->vBC = $std->vBC;
1326
        $this->stdPISST->pPIS = $std->pPIS;
1327
        $this->buildREntity();
1328
    }
1329
1330
    /**
1331
     * Load fields for tag PISST [R04], belongs to [R]
1332
     * R04|qBCProd|vAliqProd|vPIS|
1333
     * @param stdClass $std
1334
     * @return void
1335
     */
1336
    protected function r04Entity($std)
1337
    {
1338
        $this->stdPISST->qBCProd = $std->qBCProd;
1339
        $this->stdPISST->vAliqProd = $std->vAliqProd;
1340
        $this->stdPISST->vPIS = $std->vPIS;
1341
        $this->buildREntity();
1342
    }
1343
1344
    /**
1345
     * Create tag PISST
1346
     * Rxx|vBC|pPIS|qBCProd|vAliqProd|vPIS|
1347
     * @return void
1348
     */
1349
    protected function buildREntity()
1350
    {
1351
        $this->make->tagPISST($this->stdPISST);
1352
    }
1353
1354
    /**
1355
     * Load fields for tag COFINS [S]
1356
     * S|
1357
     * @param stdClass $std
1358
     * @return void
1359
     */
1360
    protected function sEntity($std)
1361
    {
1362
        //carrega numero do item
1363
        $std->item = $this->item;
1364
        $this->stdCOFINS = $std;
1365
        $this->stdCOFINS->vBC = null;
1366
        $this->stdCOFINS->pCOFINS = null;
1367
        $this->stdCOFINS->vCOFINS = null;
1368
        $this->stdCOFINS->qBCProd = null;
1369
        $this->stdCOFINS->vAliqProd = null;
1370
    }
1371
1372
    /**
1373
     * Load fields for tag COFINS [S02], belongs to [S]
1374
     * S02|CST|vBC|pCOFINS|vCOFINS|
1375
     * @param stdClass $std
1376
     * @return void
1377
     */
1378
    protected function s02Entity($std)
1379
    {
1380
        $this->stdCOFINS->CST = $std->CST;
1381
        $this->stdCOFINS->vBC = $std->vBC;
1382
        $this->stdCOFINS->pCOFINS = $std->pCOFINS;
1383
        $this->stdCOFINS->vCOFINS = $std->vCOFINS;
1384
        $this->buildSEntity();
1385
    }
1386
1387
    /**
1388
     * Load fields for tag COFINS [S03], belongs to [S]
1389
     * S03|CST|qBCProd|vAliqProd|vCOFINS|
1390
     * @param stdClass $std
1391
     * @return void
1392
     */
1393
    protected function s03Entity($std)
1394
    {
1395
        $this->stdCOFINS->CST = $std->CST;
1396
        $this->stdCOFINS->qBCProd = $std->qBCProd;
1397
        $this->stdCOFINS->vAliqProd = $std->vAliqProd;
1398
        $this->stdCOFINS->vCOFINS = $std->vCOFINS;
1399
        $this->buildSEntity();
1400
    }
1401
1402
    /**
1403
     * Load fields for tag COFINS [S04], belongs to [S]
1404
     * S04|CST|
1405
     * @param stdClass $std
1406
     * @return void
1407
     */
1408
    protected function s04Entity($std)
1409
    {
1410
        $this->stdCOFINS->CST = $std->CST;
1411
        $this->buildSEntity();
1412
    }
1413
1414
    /**
1415
     * Load fields for tag COFINS [S05], belongs to [S]
1416
     * S05|CST|vCOFINS|
1417
     * @param stdClass $std
1418
     * @return void
1419
     */
1420
    protected function s05Entity($std)
1421
    {
1422
        $this->stdCOFINS->CST = $std->CST;
1423
        $this->stdCOFINS->vCOFINS = $std->vCOFINS;
1424
    }
1425
1426
    /**
1427
     * Load fields for tag COFINS [S07], belongs to [S]
1428
     * S07|vBC|pCOFINS|
1429
     * @param stdClass $std
1430
     * @return void
1431
     */
1432
    protected function s07Entity($std)
1433
    {
1434
        $this->stdCOFINS->vBC = $std->vBC;
1435
        $this->stdCOFINS->pCOFINS = $std->pCOFINS;
1436
        $this->buildSEntity();
1437
    }
1438
1439
    /**
1440
     * Load fields for tag COFINS [S09], belongs to [S]
1441
     * S09|qBCProd|vAliqProd|
1442
     * @param stdClass $std
1443
     * @return void
1444
     */
1445
    protected function s09Entity($std)
1446
    {
1447
        $this->stdCOFINS->qBCProd = $std->qBCProd;
1448
        $this->stdCOFINS->vAliqProd = $std->vAliqProd;
1449
        $this->buildSEntity();
1450
    }
1451
1452
    /**
1453
     * Create tag COFINS [S]
1454
     * Sxx|CST|vBC|pCOFINS|vCOFINS|qBCProd|vAliqProd|
1455
     * @return void
1456
     */
1457
    protected function buildSEntity()
1458
    {
1459
        $this->make->tagCOFINS($this->stdCOFINS);
1460
    }
1461
1462
    /**
1463
     * Load fields for tag COFINSST [T]
1464
     * T|vCOFINS|
1465
     * @param stdClass $std
1466
     * @return void
1467
     */
1468
    protected function tEntity($std)
1469
    {
1470
        //carrega numero do item
1471
        $std->item = $this->item;
1472
        $this->stdCOFINSST = $std;
1473
        $this->stdCOFINSST->vBC = null;
1474
        $this->stdCOFINSST->pCOFINS = null;
1475
        $this->stdCOFINSST->vCOFINS = null;
1476
        $this->stdCOFINSST->qBCProd = null;
1477
        $this->stdCOFINSST->vAliqProd = null;
1478
    }
1479
1480
    /**
1481
     * Load fields for tag COFINSST [T02], belongs to [T]
1482
     * T02|vBC|pCOFINS|
1483
     * @param stdClass $std
1484
     * @return void
1485
     */
1486
    protected function t02Entity($std)
1487
    {
1488
        $this->stdCOFINSST->vBC = $std->vBC;
1489
        $this->stdCOFINSST->pCOFINS = $std->pCOFINS;
1490
        $this->buildTEntity();
1491
    }
1492
1493
    /**
1494
     * Load fields for tag COFINSST [T04], belongs to [T]
1495
     * T04|qBCProd|vAliqProd|
1496
     * @param stdClass $std
1497
     * @return void
1498
     */
1499
    protected function t04Entity($std)
1500
    {
1501
        $this->stdCOFINSST->qBCProd = $std->qBCProd;
1502
        $this->stdCOFINSST->vAliqProd = $std->vAliqProd;
1503
        $this->buildTEntity();
1504
    }
1505
1506
    /**
1507
     * Create tag COFINSST [T]
1508
     * Txx|vBC|pCOFINS|qBCProd|vAliqProd|vCOFINS|
1509
     * @return void
1510
     */
1511
    protected function buildTEntity()
1512
    {
1513
        $this->stdCOFINSST->item = $this->item;
1514
        $this->make->tagCOFINSST($this->stdCOFINSST);
1515
    }
1516
1517
    /**
1518
     * Create tag ISSQN [U]
1519
     * U|vBC|vAliq|vISSQN|cMunFG|cListServ|vDeducao|vOutro|vDescIncond
1520
     *  |vDescCond|vISSRet|indISS|cServico|cMun|cPais|nProcesso|indIncentivo|
1521
     * @param stdClass $std
1522
     * @return void
1523
     */
1524
    protected function uEntity($std)
1525
    {
1526
        $std->item = $this->item;
1527
        $this->make->tagISSQN($std);
1528
    }
1529
1530
    /**
1531
     * Create tag tagimpostoDevol [UA]
1532
     * UA|pDevol|vIPIDevol|
1533
     * @param stdClass $std
1534
     * @return void
1535
     */
1536
    protected function uaEntity($std)
1537
    {
1538
        $std->item = $this->item;
1539
        $this->make->tagimpostoDevol($std);
1540
    }
1541
1542
    /**
1543
     * Linha W [W]
1544
     * W|
1545
     * @param stdClass $std
1546
     * @return void
1547
     */
1548
    protected function wEntity($std)
0 ignored issues
show
The parameter $std is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1549
    {
1550
        //fake não faz nada
1551
        $field = null;
0 ignored issues
show
$field 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...
1552
    }
1553
1554
    /**
1555
     * Cria tag ICMSTot [W02], belongs to [W]
1556
     * W02|vBC|vICMS|vICMSDeson|vFCP|vBCST|vST|vFCPST|vFCPSTRet|vProd|vFrete|vSeg|vDesc|vII|vIPI|vIPIDevol|vPIS|vCOFINS|vOutro|vNF|vTotTrib|vFCPUFDest|vICMSUFDest|vICMSUFRemet|
1557
     * @param stdClass $std
1558
     * @return void
1559
     */
1560
    protected function w02Entity($std)
1561
    {
1562
        $this->make->tagICMSTot($std);
1563
    }
1564
1565
    protected function w04cEntity($std)
0 ignored issues
show
The parameter $std is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1566
    {
1567
    }
1568
1569
    protected function w04eEntity($std)
0 ignored issues
show
The parameter $std is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1570
    {
1571
    }
1572
1573
    protected function w04gEntity($std)
0 ignored issues
show
The parameter $std is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1574
    {
1575
    }
1576
1577
    /**
1578
     * Create tag ISSQNTot [W17], belongs to [W]
1579
     * W17|vServ|vBC|vISS|vPIS|vCOFINS|dCompet|vDeducao|vOutro|vDescIncond
1580
     *    |vDescCond|vISSRet|cRegTrib|
1581
     * @param stdClass $std
1582
     * @return void
1583
     */
1584
    protected function w17Entity($std)
1585
    {
1586
        $this->make->tagISSQNTot($std);
1587
    }
1588
1589
    /**
1590
     * Create tag retTrib [W23], belongs to [W]
1591
     * W23|vRetPIS|vRetCOFINS|vRetCSLL|vBCIRRF|vIRRF|vBCRetPrev|vRetPrev|
1592
     * @param stdClass $std
1593
     * @return void
1594
     */
1595
    protected function w23Entity($std)
1596
    {
1597
        $this->make->tagretTrib($std);
1598
    }
1599
1600
    /**
1601
     * Create tag transp [X]
1602
     * X|modFrete|
1603
     * @param stdClass $std
1604
     * @return void
1605
     */
1606
    protected function xEntity($std)
1607
    {
1608
        $this->make->tagtransp($std);
1609
    }
1610
1611
    /**
1612
     * Load fields for tag transporta [X03], belongs to [X]
1613
     * X03|xNome|IE|xEnder|xMun|UF|
1614
     * @param stdClass $std
1615
     * @return void
1616
     */
1617
    protected function x03Entity($std)
1618
    {
1619
        $this->stdTransporta = $std;
1620
    }
1621
1622
    /**
1623
     * Load fields for tag transporta [X04], with CNPJ, belonsgs to [X03]
1624
     * X04|CNPJ|
1625
     * @param stdClass $std
1626
     * @return void
1627
     */
1628
    protected function x04Entity($std)
1629
    {
1630
        $this->stdTransporta->CNPJ = $std->CNPJ;
1631
        $this->stdTransporta->CPF = null;
1632
        $this->make->tagtransporta($this->stdTransporta);
1633
        $this->stdTransporta = null;
1634
    }
1635
1636
    /**
1637
     * Load fields for tag transporta [X05], with CPF, belonsgs to [X03]
1638
     * X05|CPF|
1639
     * @param stdClass $std
1640
     * @return void
1641
     */
1642
    protected function x05Entity($std)
1643
    {
1644
        $this->stdTransporta->CPF = $std->CPF;
1645
        $this->stdTransporta->CNPJ = null;
1646
        $this->make->tagtransporta($this->stdTransporta);
1647
        $this->stdTransporta = null;
1648
    }
1649
1650
    /**
1651
     * Load fields for tag retTransp [X11], belongs to [X]
1652
     * X11|vServ|vBCRet|pICMSRet|vICMSRet|CFOP|cMunFG|
1653
     * @param stdClass $std
1654
     * @return void
1655
     */
1656
    protected function x11Entity($std)
1657
    {
1658
        $this->make->tagretTransp($std);
1659
    }
1660
1661
    /**
1662
     * Create tag veicTransp [X18], belongs to [X]
1663
     * X18|placa|UF|RNTC|
1664
     * @param stdClass $std
1665
     * @return void
1666
     */
1667
    protected function x18Entity($std)
1668
    {
1669
        $this->make->tagveicTransp($std);
1670
    }
1671
1672
    /**
1673
     * Create tag reboque [X22], belogns to [X]
1674
     * X22|placa|UF|RNTC|
1675
     * @param stdClass $std
1676
     * @return void
1677
     */
1678
    protected function x22Entity($std)
1679
    {
1680
        $this->make->tagreboque($std);
1681
    }
1682
1683
    /**
1684
     * Create tag vagao [X25a], belogns to [X01]
1685
     * X25a|vagao|
1686
     * @param stdClass $std
1687
     * @return void
1688
     */
1689
    protected function x25aEntity($std)
1690
    {
1691
        $this->make->tagvagao($std);
1692
    }
1693
1694
    /**
1695
     * Create tag balsa [X25b], belogns to [X01]
1696
     * X25b|balsa|
1697
     * @param stdClass $std
1698
     * @return void
1699
     */
1700
    protected function x25bEntity($std)
1701
    {
1702
        $this->make->tagbalsa($std);
1703
    }
1704
1705
    /**
1706
     * Create tag vol [X26], belongs to [X]
1707
     * X26|qVol|esp|marca|nVol|pesoL|pesoB|
1708
     * @param stdClass $std
1709
     * @return void
1710
     */
1711
    protected function x26Entity($std)
1712
    {
1713
        $this->volId += 1;
1714
        $std->item = $this->volId;
1715
        $this->make->tagvol($std);
1716
    }
1717
1718
    /**
1719
     * Create tag lacre [X33], belongs to [X]
1720
     * X33|nLacre|
1721
     * @param stdClass $std
1722
     * @return void
1723
     */
1724
    protected function x33Entity($std)
1725
    {
1726
        $std->item = $this->volId;
1727
        $this->make->taglacres($std);
1728
    }
1729
1730
    /**
1731
     * Create tag vol
1732
     * @param stdClass $std
1733
     * @return void
1734
     */
1735
    protected function buildVolEntity($std)
1736
    {
1737
        $this->make->tagvol($std);
1738
    }
1739
1740
    /**
1741
     * yEntity [Y]
1742
     *
1743
     * LOCAL
1744
     * Y|vTroco|
1745
     * @param stdClass $std
1746
     * @return void
1747
     */
1748
    protected function yEntity($std)
1749
    {
1750
        if ($this->baselayout !== 'SEBRAE') {
1751
            $this->make->tagpag($std);
1752
        }
1753
    }
1754
1755
    /**
1756
     * Create tag fat [Y02]
1757
     * Y02|nFat|vOrig|vDesc|vLiq|
1758
     * @param stdClass $std
1759
     * @return void
1760
     */
1761
    protected function y02Entity($std)
1762
    {
1763
        $this->make->tagfat($std);
1764
    }
1765
1766
    /**
1767
     * Create tag dup [Y07]
1768
     * Y07|nDup|dVenc|vDup|
1769
     * @param stdClass $std
1770
     * @return void
1771
     */
1772
    protected function y07Entity($std)
1773
    {
1774
        $this->make->tagdup($std);
1775
    }
1776
1777
    /**
1778
     * Creates tag detPag and card [YA]
1779
     * YA|tPag|vPag|CNPJ|tBand|cAut|tpIntegra|xPag|
1780
     * SEBRAE
1781
     * YA|troco|
1782
     * @param stdClass $std
1783
     * @return void
1784
     */
1785
    protected function yaEntity($std)
1786
    {
1787
        if ($this->baselayout === 'SEBRAE') {
1788
            $this->make->tagpag($std);
1789
        } else {
1790
            $this->make->tagdetPag($std);
1791
        }
1792
    }
1793
1794
    /**
1795
     * Creates tag detPag and card [YA]
1796
     * SEBRAE
1797
     * YA01|indPag|tPag|vPag|",
1798
     * @param stdClass $std
1799
     */
1800
    protected function ya01Entity($std)
1801
    {
1802
        $this->make->tagdetPag($std);
1803
    }
1804
    
1805
    /**
1806
     * Create tag infIntermed [YB]
1807
     * YB|CNPJ|idCadIntTran
1808
     * @param type $std
1809
     */
1810
    protected function ybEntity($std)
1811
    {
1812
        $this->make->tagIntermed($std);
1813
    }
1814
1815
    /**
1816
     * Create a tag infAdic [Z]
1817
     * Z|infAdFisco|infCpl|
1818
     * @param stdClass $std
1819
     * @return void
1820
     */
1821
    protected function zEntity($std)
1822
    {
1823
        $this->make->taginfAdic($std);
1824
    }
1825
1826
    /**
1827
     * Create tag obsCont [Z04]
1828
     * Z04|xCampo|xTexto|
1829
     * @param stdClass $std
1830
     * @return void
1831
     */
1832
    protected function z04Entity($std)
1833
    {
1834
        $this->make->tagobsCont($std);
1835
    }
1836
1837
    /**
1838
     * Create tag obsFisco [Z07]
1839
     * Z07|xCampo|xTexto|
1840
     * @param stdClass $std
1841
     * @return void
1842
     */
1843
    protected function z07Entity($std)
1844
    {
1845
        $this->make->tagobsFisco($std);
1846
    }
1847
1848
    /**
1849
     * Create tag procRef [Z10]
1850
     * Z10|nProc|indProc|
1851
     * @param stdClass $std
1852
     * @return void
1853
     */
1854
    protected function z10Entity($std)
1855
    {
1856
        $this->make->tagprocRef($std);
1857
    }
1858
1859
    /**
1860
     * Create tag exporta [ZA]
1861
     * ZA|UFSaidaPais|xLocExporta|xLocDespacho|
1862
     * @param stdClass $std
1863
     * @return void
1864
     */
1865
    protected function zaEntity($std)
1866
    {
1867
        $this->make->tagexporta($std);
1868
    }
1869
1870
    /**
1871
     * Create tag compra [ZB]
1872
     * ZB|xNEmp|xPed|xCont|
1873
     * @param stdClass $std
1874
     * @return void
1875
     */
1876
    protected function zbEntity($std)
1877
    {
1878
        $this->make->tagcompra($std);
1879
    }
1880
1881
    /**
1882
     * Create tag cana [ZC]
1883
     * ZC|safra|ref|qTotMes|qTotAnt|qTotGer|vFor|vTotDed|vLiqFor|
1884
     * @param stdClass $std
1885
     * @return void
1886
     */
1887
    protected function zcEntity($std)
1888
    {
1889
        $this->make->tagcana($std);
1890
    }
1891
1892
    /**
1893
     * Create tag forDia [ZC04]
1894
     * ZC04|dia|qtde|
1895
     * @param stdClass $std
1896
     * @return void
1897
     */
1898
    protected function zc04Entity($std)
1899
    {
1900
        $this->make->tagforDia($std);
1901
    }
1902
1903
    /**
1904
     * Create tag deduc [ZC10]
1905
     * ZC10|xDed|vDed|
1906
     * @param stdClass $std
1907
     * @return void
1908
     */
1909
    protected function zc10Entity($std)
1910
    {
1911
        $this->make->tagdeduc($std);
1912
    }
1913
    
1914
    /**
1915
     * Create tag infRespTec [ZD01]
1916
     * ZD|CNPJ|xContato|email|fone|CSRTidCSRT|
1917
     * @param stdClass $std
1918
     * @return void
1919
     */
1920
    protected function zdEntity($std)
1921
    {
1922
        $this->make->taginfRespTec($std);
1923
    }
1924
1925
    /**
1926
     * Create tag infNFeSupl com o qrCode para impressão da DANFCE [ZX01]
1927
     * ZX01|qrcode|urlChave|
1928
     * @param stdClass $std
1929
     * @return void
1930
     */
1931
    protected function zx01Entity($std)
1932
    {
1933
        $this->make->taginfNFeSupl($std);
1934
    }
1935
}
1936