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 K100 do Bloco K OBRIGATÓRIO [1:1] |
11
|
|
|
* REGISTRO K100: ABERTURA DO ARQUIVO DIGITAL E IDENTIFICAÇÃO DO EMPRESÁRIO OU DA SOCIEDADE EMPRESÁRIA |
12
|
|
|
*/ |
13
|
|
|
class K100 extends Element implements ElementInterface |
14
|
|
|
{ |
15
|
|
|
const REG = 'K100'; |
16
|
|
|
const LEVEL = 3; |
17
|
|
|
const PARENT = ''; |
18
|
|
|
|
19
|
|
|
protected $parameters = [ |
20
|
|
|
'cod_pais' => [ |
21
|
|
|
'type' => 'numeric', |
22
|
|
|
'regex' => '^[0-9]{5}$', |
23
|
|
|
'required' => true, |
24
|
|
|
'info' => 'Código do país da empresa, conforme tabela do Banco Central do Brasil.', |
25
|
|
|
'format' => '' |
26
|
|
|
], |
27
|
|
|
'emp_cod' => [ |
28
|
|
|
'type' => 'numeric', |
29
|
|
|
'regex' => '^[0-9]{4}$', |
30
|
|
|
'required' => true, |
31
|
|
|
'info' => 'Código de identificação da empresa participante.', |
32
|
|
|
'format' => '' |
33
|
|
|
], |
34
|
|
|
'cnpj' => [ |
35
|
|
|
'type' => 'numeric', |
36
|
|
|
'regex' => '^[0-9]{8}$', |
37
|
|
|
'required' => false, |
38
|
|
|
'info' => 'CNPJ (somente os 8 primeiros dígitos).', |
39
|
|
|
'format' => '' |
40
|
|
|
], |
41
|
|
|
'nome' => [ |
42
|
|
|
'type' => 'string', |
43
|
|
|
'regex' => '^[A-Za-z0-9]$', |
44
|
|
|
'required' => true, |
45
|
|
|
'info' => 'Nome empresarial.', |
46
|
|
|
'format' => '' |
47
|
|
|
], |
48
|
|
|
'per_part' => [ |
49
|
|
|
'type' => 'numeric', |
50
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
51
|
|
|
'required' => true, |
52
|
|
|
'info' => 'Percentual de participação total do conglomerado na empresa ' |
53
|
|
|
. 'no final do período consolidado.', |
54
|
|
|
'format' => '8v4' |
55
|
|
|
], |
56
|
|
|
'evento' => [ |
57
|
|
|
'type' => 'string', |
58
|
|
|
'regex' => '^(S|N)$', |
59
|
|
|
'required' => true, |
60
|
|
|
'info' => 'Evento societário ocorrido no período: S - Sim / N – Não', |
61
|
|
|
'format' => '' |
62
|
|
|
], |
63
|
|
|
'per_cons' => [ |
64
|
|
|
'type' => 'numeric', |
65
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
66
|
|
|
'required' => true, |
67
|
|
|
'info' => 'Percentual de consolidação da empresa no final do período consolidado:' |
68
|
|
|
.' Informar o percentual do resultado da empresa que foi para a consolidação.', |
69
|
|
|
'format' => '8v4' |
70
|
|
|
], |
71
|
|
|
'dt_ini_emp' => [ |
72
|
|
|
'type' => 'string', |
73
|
|
|
'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$', |
74
|
|
|
'required' => true, |
75
|
|
|
'info' => 'Data inicial do período da escrituração contábil da empresa que foi consolidada.', |
76
|
|
|
'format' => '' |
77
|
|
|
], |
78
|
|
|
'dt_fin_emp' => [ |
79
|
|
|
'type' => 'string', |
80
|
|
|
'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$', |
81
|
|
|
'required' => true, |
82
|
|
|
'info' => 'Data final do período da escrituração contábil da empresa que foi consolidada.', |
83
|
|
|
'format' => '' |
84
|
|
|
] |
85
|
|
|
]; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Constructor |
89
|
|
|
* @param \stdClass $std |
90
|
|
|
*/ |
91
|
|
|
public function __construct(\stdClass $std) |
92
|
|
|
{ |
93
|
|
|
parent::__construct(self::REG); |
94
|
|
|
$this->std = $this->standarize($std); |
95
|
|
|
$this->postValidation(); |
|
|
|
|
96
|
|
|
} |
97
|
|
|
} |
98
|
|
|
|
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: