D500   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 182
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 182
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
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
class D500 extends Element implements ElementInterface
10
{
11
    const REG = 'D500';
12
    const LEVEL = 2;
13
    const PARENT = 'D001';
14
15
    protected $parameters = [
16
        'IND_OPER' => [
17
            'type' => 'string',
18
            'regex' => '^[0-1]{1}$',
19
            'required' => true,
20
            'info' => 'Indicador do tipo de operação',
21
            'format' => ''
22
        ],
23
        'IND_EMIT' => [
24
            'type' => 'string',
25
            'regex' => '^[0-1]{1}$',
26
            'required' => true,
27
            'info' => 'Indicador do emitente do documento fiscal',
28
            'format' => ''
29
        ],
30
        'COD_PART' => [
31
            'type' => 'string',
32
            'regex' => '^.{1,60}$',
33
            'required' => true,
34
            'info' => 'Código do participante (campo 02 do Registro 0150):',
35
            'format' => ''
36
        ],
37
        'COD_MOD' => [
38
            'type' => 'string',
39
            'regex' => '^(21|22)+$',
40
            'required' => true,
41
            'info' => 'Código do modelo do documento fiscalValor total do estoque',
42
            'format' => ''
43
        ],
44
        'COD_SIT' => [
45
            'type' => 'numeric',
46
            'regex' => '^(0)([0-9]{1})?$',
47
            'required' => true,
48
            'info' => 'Código da situação do documento fiscal',
49
            'format' => ''
50
        ],
51
        'SER' => [
52
            'type' => 'string',
53
            'regex' => '^.{1,4}$',
54
            'required' => false,
55
            'info' => 'Série do documento fiscal',
56
            'format' => ''
57
        ],
58
        'SUB' => [
59
            'type' => 'string',
60
            'regex' => '^([0-9a-z]{0,3})?$',
61
            'required' => false,
62
            'info' => 'Subsérie do documento fiscal ',
63
            'format' => ''
64
        ],
65
        'NUM_DOC' => [
66
            'type' => 'numeric',
67
            'regex' => '^([0-9]{1,9})?$',
68
            'required' => true,
69
            'info' => 'Número do documento fiscal',
70
            'format' => ''
71
        ],
72
        'DT_DOC' => [
73
            'type' => 'string',
74
            'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$',
75
            'required' => true,
76
            'info' => 'Data da emissão do documento fiscal',
77
            'format' => ''
78
        ],
79
        'DT_A_P' => [
80
            'type' => 'string',
81
            'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$',
82
            'required' => true,
83
            'info' => 'Data da entrada (aquisição) ou da saída (prestação do serviço)',
84
            'format' => ''
85
        ],
86
        'VL_DOC' => [
87
            'type' => 'numeric',
88
            'regex' => '^\d+(\.\d*)?|\.\d+$',
89
            'required' => true,
90
            'info' => 'Valor total do documento fiscal',
91
            'format' => '15v2'
92
        ],
93
        'VL_DESC' => [
94
            'type' => 'numeric',
95
            'regex' => '^\d+(\.\d*)?|\.\d+$',
96
            'required' => false,
97
            'info' => 'Valor total do desconto',
98
            'format' => '15v2'
99
        ],
100
        'VL_SERV' => [
101
            'type' => 'numeric',
102
            'regex' => '^\d+(\.\d*)?|\.\d+$',
103
            'required' => true,
104
            'info' => 'Valor total da prestação de serviço',
105
            'format' => '15v2'
106
        ],
107
        'VL_SERV_NT' => [
108
            'type' => 'numeric',
109
            'regex' => '^\d+(\.\d*)?|\.\d+$',
110
            'required' => false,
111
            'info' => 'Valor total dos serviços não-tributados pelo ICMS',
112
            'format' => '15v2'
113
        ],
114
        'VL_TERC' => [
115
            'type' => 'numeric',
116
            'regex' => '^\d+(\.\d*)?|\.\d+$',
117
            'required' => false,
118
            'info' => 'Valores cobrados em nome de terceiros',
119
            'format' => '15v2'
120
        ],
121
        'VL_DA' => [
122
            'type' => 'numeric',
123
            'regex' => '^\d+(\.\d*)?|\.\d+$',
124
            'required' => false,
125
            'info' => 'Valor de outras despesas indicadas no documento fiscal',
126
            'format' => '15v2'
127
        ],
128
        'VL_BC_ICMS' => [
129
            'type' => 'numeric',
130
            'regex' => '^\d+(\.\d*)?|\.\d+$',
131
            'required' => false,
132
            'info' => 'Valor da base de cálculo do ICMS',
133
            'format' => '15v2'
134
        ],
135
        'VL_ICMS' => [
136
            'type' => 'numeric',
137
            'regex' => '^\d+(\.\d*)?|\.\d+$',
138
            'required' => false,
139
            'info' => 'Valor do ICMS',
140
            'format' => '15v2'
141
        ],
142
        'COD_INF' => [
143
            'type' => 'numeric',
144
            'regex' => '^([0-1]{1,6})$',
145
            'required' => false,
146
            'info' => 'Código da informação complementar do documento fiscal',
147
            'format' => ''
148
        ],
149
        'VL_PIS' => [
150
            'type' => 'numeric',
151
            'regex' => '^\d+(\.\d*)?|\.\d+$',
152
            'required' => false,
153
            'info' => 'Valor do PIS',
154
            'format' => '15v2'
155
        ],
156
        'VL_COFINS' => [
157
            'type' => 'numeric',
158
            'regex' => '^\d+(\.\d*)?|\.\d+$',
159
            'required' => false,
160
            'info' => 'Valor da COFINS',
161
            'format' => '15v2'
162
        ],
163
        'COD_CTA' => [
164
            'type' => 'string',
165
            'regex' => '(.*)',
166
            'required' => false,
167
            'info' => 'Código da conta analítica contábil debitada/creditada',
168
            'format' => ''
169
        ],
170
        'TP_ASSINANTE' => [
171
            'type' => 'numeric',
172
            'regex' => '^(1|2|3|4|5|6)$',
173
            'required' => false,
174
            'info' => 'Código do Tipo de Assinante',
175
            'format' => ''
176
        ]
177
    ];
178
179
180
    /**
181
     * Constructor
182
     * @param \stdClass $std
183
     */
184
    public function __construct(\stdClass $std)
185
    {
186
        parent::__construct(self::REG);
187
        $this->std = $this->standarize($std);
188
        $this->postValidation();
0 ignored issues
show
Unused Code introduced by
The call to the method NFePHP\EFD\Elements\ICMSIPI\D500::postValidation() seems un-needed as the method has no side-effects.

PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.

Let’s take a look at an example:

class User
{
    private $email;

    public function getEmail()
    {
        return $this->email;
    }

    public function setEmail($email)
    {
        $this->email = $email;
    }
}

If we look at the getEmail() method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:

$user = new User();
$user->getEmail(); // This line could safely be removed as it has no effect.

On the hand, if we look at the setEmail(), this method _has_ side-effects. In the following case, we could not remove the method call:

$user = new User();
$user->setEmail('email@domain'); // This line has a side-effect (it changes an
                                 // instance variable).
Loading history...
189
    }
190
}
191