Completed
Pull Request — master (#464)
by
unknown
14:04
created

C810::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 5
Ratio 100 %

Importance

Changes 0
Metric Value
dl 5
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace NFePHP\EFD\Elements\ICMSIPI;
4
5
use NFePHP\Common\Keys;
6
use NFePHP\EFD\Common\Element;
7
use NFePHP\EFD\Common\ElementInterface;
8
use \stdClass;
9
10
/**
11
 * REGISTRO C810: ITENS  DO  DOCUMENTO  DO  CUPOM  FISCAL ELETRÔNICO  –  SAT (CF-E-SAT)  (CÓDIGO 59):
12
 * @package NFePHP\EFD\Elements\ICMSIPI
13
 */
14 View Code Duplication
class C810 extends Element implements ElementInterface
0 ignored issues
show
Duplication introduced by
This class 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...
15
{
16
    const REG = 'C810';
17
    const LEVEL = 3;
18
    const PARENT = 'C800';
19
20
    protected $parameters = [
21
        'NUM_ITEM' => [
22
            'type'     => 'numeric',
23
            'regex'    => '^[0-9]{3}$',
24
            'required' => true,
25
            'info'     => 'Número do item no documento fiscal',
26
            'format'   => ''
27
        ],
28
        'COD_ITEM' => [
29
            'type'     => 'string',
30
            'regex'    => '^[0-9]{60}$',
31
            'required' => true,
32
            'info'     => 'Código do item (campo 02 do Registro 0200)',
33
            'format'   => ''
34
        ],
35
        'QTD' => [
36
            'type'     => 'numeric',
37
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
38
            'required' => true,
39
            'info'     => 'Quantidade do item',
40
            'format'   => '15v5'
41
        ],
42
        'UNID' => [
43
            'type'     => 'string',
44
            'regex'    => '^[0-9]{6}$',
45
            'required' => true,
46
            'info'     => 'Unidade do item (Campo 02 do registro 0190)',
47
            'format'   => ''
48
        ],
49
        'VL_ITEM' => [
50
            'type'     => 'numeric',
51
            'regex'    => '^[0-9]{2}$',
52
            'required' => true,
53
            'info'     => 'Valor total do item (mercadorias ou serviços)',
54
            'format'   => ''
55
        ],
56
        'CST_ICMS' => [
57
            'type' => 'string',
58
            'regex' => '^[0-9]{3}$',
59
            'required' => true,
60
            'info' => 'Código da Situação Tributária',
61
            'format' => ''
62
        ],
63
        'CFOP' => [
64
            'type' => 'string',
65
            'regex' => '^[0-9]{4}$',
66
            'required' => true,
67
            'info' => 'Código Fiscal de Operação e Prestação',
68
            'format' => ''
69
        ],
70
    ];
71
72
    /**
73
     * Constructor
74
     * @param \stdClass $std
75
     */
76
    public function __construct(\stdClass $std)
77
    {
78
        parent::__construct(self::REG);
79
        $this->std = $this->standarize($std);
80
    }
81
}
82