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 I050 do Bloco I OBRIGATÓRIO [1:N] |
11
|
|
|
* EGISTRO I050: PLANO DE CONTAS |
12
|
|
|
*/ |
13
|
|
|
class I050 extends Element implements ElementInterface |
14
|
|
|
{ |
15
|
|
|
const REG = 'I050'; |
16
|
|
|
const LEVEL = 3; |
17
|
|
|
const PARENT = ''; |
18
|
|
|
|
19
|
|
|
protected $parameters = [ |
20
|
|
|
'dt_alt' => [ |
21
|
|
|
'type' => 'string', |
22
|
|
|
'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$', |
23
|
|
|
'required' => false, |
24
|
|
|
'info' => 'Data de inclusao/alteracao.', |
25
|
|
|
'format' => '' |
26
|
|
|
], |
27
|
|
|
'cod_nat' => [ |
28
|
|
|
'type' => 'string', |
29
|
|
|
'regex' => '^(01|02|03|04|05|09){2}$', |
30
|
|
|
'required' => true, |
31
|
|
|
'info' => 'Código da natureza da conta/grupo de contas, conforme tabela publicada pelo Sped.', |
32
|
|
|
'format' => '' |
33
|
|
|
], |
34
|
|
|
'ind_cta' => [ |
35
|
|
|
'type' => 'string', |
36
|
|
|
'regex' => '^[S-A]{2}$', |
37
|
|
|
'required' => true, |
38
|
|
|
'info' => 'Indicador do tipo de Conta: S-Sintetico, A-Analitico.', |
39
|
|
|
'format' => '' |
40
|
|
|
], |
41
|
|
|
'nivel' => [ |
42
|
|
|
'type' => 'numeric', |
43
|
|
|
'regex' => '^([0-9]*)$', |
44
|
|
|
'required' => true, |
45
|
|
|
'info' => 'Nivel da conta analitica/grupo de contas.', |
46
|
|
|
'format' => '' |
47
|
|
|
], |
48
|
|
|
'cod_cta' => [ |
49
|
|
|
'type' => 'string', |
50
|
|
|
'regex' => '^[A-Za-z0-9]$', |
51
|
|
|
'required' => true, |
52
|
|
|
'info' => 'Codigo da conta analitica/grupo de contas.', |
53
|
|
|
'format' => '' |
54
|
|
|
], |
55
|
|
|
'cod_cta_sup' => [ |
56
|
|
|
'type' => 'string', |
57
|
|
|
'regex' => '^[A-Za-z0-9]$', |
58
|
|
|
'required' => false, |
59
|
|
|
'info' => 'Codigo da conta sintetica/grupo de contas de nivel imediatamente superior.', |
60
|
|
|
'format' => '' |
61
|
|
|
], |
62
|
|
|
'cta' => [ |
63
|
|
|
'type' => 'string', |
64
|
|
|
'regex' => '^[A-Za-z0-9]$', |
65
|
|
|
'required' => true, |
66
|
|
|
'info' => 'Nome da conta analitica/grupo de contas.', |
67
|
|
|
'format' => '' |
68
|
|
|
] |
69
|
|
|
]; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Constructor |
73
|
|
|
* @param \stdClass $std |
74
|
|
|
*/ |
75
|
|
|
public function __construct(\stdClass $std) |
76
|
|
|
{ |
77
|
|
|
parent::__construct(self::REG); |
78
|
|
|
$this->std = $this->standarize($std); |
79
|
|
|
$this->postValidation(); |
|
|
|
|
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|
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: