|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace NFePHP\ECD\Elements; |
|
4
|
|
|
|
|
5
|
|
|
use NFePHP\ECD\Common\Element; |
|
6
|
|
|
use NFePHP\ECD\Common\ElementInterface; |
|
7
|
|
|
use \stdClass; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Elemento I200 do Bloco I OBRIGATÓRIO [0:N] |
|
11
|
|
|
* REGISTRO I200: LANÇAMENTO CONTÁBIL |
|
12
|
|
|
*/ |
|
13
|
|
|
class I200 extends Element implements ElementInterface |
|
14
|
|
|
{ |
|
15
|
|
|
const REG = 'I200'; |
|
16
|
|
|
const LEVEL = 3; |
|
17
|
|
|
const PARENT = 'I010'; |
|
18
|
|
|
|
|
19
|
|
|
protected $parameters = [ |
|
20
|
|
|
'num_lcto' => [ |
|
21
|
|
|
'type' => 'string', |
|
22
|
|
|
'regex' => '^[0-9]*$', |
|
23
|
|
|
'required' => true, |
|
24
|
|
|
'info' => 'Número ou Código de identificação único do lançamento contábil.', |
|
25
|
|
|
'format' => '' |
|
26
|
|
|
], |
|
27
|
|
|
'dt_lcto' => [ |
|
28
|
|
|
'type' => 'string', |
|
29
|
|
|
'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$', |
|
30
|
|
|
'required' => true, |
|
31
|
|
|
'info' => 'Data do lançamento.', |
|
32
|
|
|
'format' => '' |
|
33
|
|
|
], |
|
34
|
|
|
'vl_lcto' => [ |
|
35
|
|
|
'type' => 'numeric', |
|
36
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
37
|
|
|
'required' => true, |
|
38
|
|
|
'info' => 'Valor do lancamento.', |
|
39
|
|
|
'format' => '19v2' |
|
40
|
|
|
], |
|
41
|
|
|
'ind_lcto' => [ |
|
42
|
|
|
'type' => 'string', |
|
43
|
|
|
'regex' => '^(N|E)$', |
|
44
|
|
|
'required' => true, |
|
45
|
|
|
'info' => 'Indicador do tipo de lançamento: ' |
|
46
|
|
|
. 'N - Lançamento normal (todos os lançamentos, exceto os de encerramento das contas de resultado); ' |
|
47
|
|
|
. 'E - Lançamento de encerramento de contas de resultado. ' |
|
48
|
|
|
. 'X – Lançamento extemporâneo.', |
|
49
|
|
|
'format' => '' |
|
50
|
|
|
], |
|
51
|
|
|
'dt_lcto_ext' => [ |
|
52
|
|
|
'type' => 'string', |
|
53
|
|
|
'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$', |
|
54
|
|
|
'required' => false, |
|
55
|
|
|
'info' => 'Data de ocorrência dos fatos objeto do lançamento extemporâneo.', |
|
56
|
|
|
'format' => '' |
|
57
|
|
|
] |
|
58
|
|
|
]; |
|
59
|
|
|
|
|
60
|
|
|
// , |
|
61
|
|
|
// 'vl_lcto_mf' => [ |
|
62
|
|
|
// 'type' => 'string', |
|
63
|
|
|
// 'regex' => '^[0-9]{19}$', |
|
64
|
|
|
// 'required' => false, |
|
65
|
|
|
// 'info' => 'Valor do lançamento em moeda funcional, convertido para reais.', |
|
66
|
|
|
// 'format' => '' |
|
67
|
|
|
// ] |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Constructor |
|
71
|
|
|
* @param \stdClass $std |
|
72
|
|
|
*/ |
|
73
|
|
|
public function __construct(\stdClass $std) |
|
74
|
|
|
{ |
|
75
|
|
|
parent::__construct(self::REG); |
|
76
|
|
|
$this->std = $this->standarize($std); |
|
77
|
|
|
$this->postValidation(); |
|
|
|
|
|
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|
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:
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: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: