Completed
Push — master ( 115df9...3578a0 )
by Roberto
23s queued 11s
created

D300::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 5
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 5
loc 5
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace NFePHP\EFD\Elements\ICMSIPI;
4
5
use NFePHP\EFD\Common\Element;
6
use NFePHP\EFD\Common\ElementInterface;
7
use \stdClass;
8
9 View Code Duplication
class D300 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...
10
{
11
    const REG = 'D300';
12
    const LEVEL = 2;
13
    const PARENT = '';
14
15
    protected $parameters = [
16
        'COD_MOD' => [
17
            'type'     => 'string',
18
            'regex'    => '^[0-9]{2}$',
19
            'required' => true,
20
            'info'     => 'Código do modelo do documento fiscal, conforme a tabela 4.1.1',
21
            'format'   => ''
22
        ],
23
        'SER' => [
24
            'type'     => 'string',
25
            'regex'    => '^[0-9]{4}$',
26
            'required' => true,
27
            'info'     => 'Série do documento fiscal',
28
            'format'   => ''
29
        ],
30
        'SUB' => [
31
            'type'     => 'numeric',
32
            'regex'    => '^[0-9]{4}$',
33
            'required' => true,
34
            'info'     => 'Subsérie do documento fiscal',
35
            'format'   => ''
36
        ],
37
        'NUM_DOC_INI' => [
38
            'type'     => 'numeric',
39
            'regex'    => '^[0-9]{6}$',
40
            'required' => true,
41
            'info'     => 'Número do primeiro documento fiscal emitido (mesmo modelo, série e subsérie)',
42
            'format'   => ''
43
        ],
44
        'NUM_DOC_FIN' => [
45
            'type'     => 'numeric',
46
            'regex'    => '',
47
            'required' => true,
48
            'info'     => 'Número do último documento fiscal emitido (mesmo modelo, série e subsérie)',
49
            'format'   => ''
50
        ],
51
        'CST_ICMS' => [
52
            'type'     => 'numeric',
53
            'regex'    => '',
54
            'required' => true,
55
            'info'     => 'Código da Situação Tributária, conforme a tabela indicada no item 4.3.1',
56
            'format'   => ''
57
        ],
58
        'CFOP' => [
59
            'type'     => 'numeric',
60
            'regex'    => '',
61
            'required' => true,
62
            'info'     => 'Código Fiscal de Operação e Prestação conforme tabela indicada no item 4.2.2',
63
            'format'   => ''
64
        ],
65
        'ALIQ_ICMS' => [
66
            'type'     => 'numeric',
67
            'regex'    => '^[0-9]{6}$',
68
            'required' => true,
69
            'info'     => 'Alíquota do ICMS',
70
            'format'   => ''
71
        ],
72
        'DT_DOC' => [
73
            'type'     => 'numeric',
74
            'regex'    => '',
75
            'required' => true,
76
            'info'     => 'Data da emissão dos documentos fiscais',
77
            'format'   => ''
78
        ],
79
        'VL_OPR' => [
80
            'type'     => 'numeric',
81
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
82
            'required' => true,
83
            'info'     => 'Valor total acumulado das operações correspondentes à combinação de CST_ICMS, CFOP e '
84
            .'alíquota do ICMS, incluídas as despesas acessórias e acréscimos',
85
            'format'   => '15v2'
86
        ],
87
        'VL_DESC' => [
88
            'type'     => 'numeric',
89
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
90
            'required' => true,
91
            'info'     => 'Valor total dos descontos',
92
            'format'   => '15v2'
93
        ],
94
        'VL_SERV' => [
95
            'type'     => 'numeric',
96
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
97
            'required' => true,
98
            'info'     => 'Valor total da prestação de serviço',
99
            'format'   => '15v2'
100
        ],
101
        'VL_SEG' => [
102
            'type'     => 'numeric',
103
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
104
            'required' => true,
105
            'info'     => 'Valor de seguro',
106
            'format'   => '15v2'
107
        ],
108
        'VL_OUTDESP' => [
109
            'type'     => 'numeric',
110
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
111
            'required' => true,
112
            'info'     => 'Valor de outras despesas',
113
            'format'   => '15v2'
114
        ],
115
        'VL_BC_ICMS' => [
116
            'type'     => 'numeric',
117
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
118
            'required' => true,
119
            'info'     => 'Valor total da base de cálculo do ICMS',
120
            'format'   => '15v2'
121
        ],
122
        'VL_ICMS' => [
123
            'type'     => 'numeric',
124
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
125
            'required' => true,
126
            'info'     => 'Valor total do ICMS',
127
            'format'   => '15v2'
128
        ],
129
        'VL_RED_BC' => [
130
            'type'     => 'numeric',
131
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
132
            'required' => true,
133
            'info'     => 'Valor não tributado em função da redução da base de cálculo do ICMS, referente à '
134
            .'combinação de CST_ICMS, CFOP e alíquota do ICMS',
135
            'format'   => '15v2'
136
        ],
137
        'COD_OBS' => [
138
            'type'     => 'string',
139
            'regex'    => '^.{1,6}$',
140
            'required' => true,
141
            'info'     => 'Código da observação do lançamento fiscal (campo 02 do Registro 0460)',
142
            'format'   => ''
143
        ],
144
        'COD_CTA' => [
145
            'type'     => 'string',
146
            'regex'    => '^[0-9]{0}$',
147
            'required' => true,
148
            'info'     => 'Código da conta analítica contábil debitada/creditada',
149
            'format'   => ''
150
        ]
151
    ];
152
153
    /**
154
     * Constructor
155
     * @param \stdClass $std
156
     */
157
    public function __construct(\stdClass $std)
158
    {
159
        parent::__construct(self::REG);
160
        $this->std = $this->standarize($std);
161
    }
162
}
163