|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace NFePHP\ECF\Elements; |
|
4
|
|
|
|
|
5
|
|
|
use NFePHP\ECF\Common\Element; |
|
6
|
|
|
use NFePHP\ECF\Common\ElementInterface; |
|
7
|
|
|
use \stdClass; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Elemento 0000 do Bloco 0 OBRIGATÓRIO [1:1] |
|
11
|
|
|
* REGISTRO 0000: ABERTURA DO ARQUIVO DIGITAL E IDENTIFICAÇÃO DO EMPRESÁRIO OU DA SOCIEDADE EMPRESÁRIA |
|
12
|
|
|
*/ |
|
13
|
|
View Code Duplication |
class Z0000 extends Element implements ElementInterface |
|
|
|
|
|
|
14
|
|
|
{ |
|
15
|
|
|
const REG = '0000'; |
|
16
|
|
|
const LEVEL = 0; |
|
17
|
|
|
const PARENT = ''; |
|
18
|
|
|
|
|
19
|
|
|
protected $parameters = [ |
|
20
|
|
|
'NOME_ESC' => [ |
|
21
|
|
|
'type' => 'string', |
|
22
|
|
|
'regex' => '^(LECF)$', |
|
23
|
|
|
'required' => true, |
|
24
|
|
|
'info' => 'Texto fixo contendo LECF.', |
|
25
|
|
|
'format' => '' |
|
26
|
|
|
], |
|
27
|
|
|
'COD_VER' => [ |
|
28
|
|
|
'type' => 'string', |
|
29
|
|
|
'regex' => '^(0006)$', |
|
30
|
|
|
'required' => true, |
|
31
|
|
|
'info' => 'codigo da versao do layout.', |
|
32
|
|
|
'format' => '' |
|
33
|
|
|
], |
|
34
|
|
|
'CNPJ' => [ |
|
35
|
|
|
'type' => 'string', |
|
36
|
|
|
'regex' => '^[0-9]{14}$', |
|
37
|
|
|
'required' => true, |
|
38
|
|
|
'info' => 'Número de inscrição da entidade no CNPJ.', |
|
39
|
|
|
'format' => '' |
|
40
|
|
|
], |
|
41
|
|
|
'NOME' => [ |
|
42
|
|
|
'type' => 'string', |
|
43
|
|
|
'regex' => '^.{2,100}$', |
|
44
|
|
|
'required' => true, |
|
45
|
|
|
'info' => 'Nome empresarial da entidade.', |
|
46
|
|
|
'format' => '' |
|
47
|
|
|
], |
|
48
|
|
|
'IND_SIT_INI_PER' => [ |
|
49
|
|
|
'type' => 'numeric', |
|
50
|
|
|
'regex' => '^(0|1|2|3|4)$', |
|
51
|
|
|
'required' => true, |
|
52
|
|
|
'info' => 'Indicador de situação no início do período.', |
|
53
|
|
|
'format' => '' |
|
54
|
|
|
], |
|
55
|
|
|
'SIT_ESPECIAL' => [ |
|
56
|
|
|
'type' => 'numeric', |
|
57
|
|
|
'regex' => '^(0|1|2|3|4|5|6|7|8|9)$', |
|
58
|
|
|
'required' => false, |
|
59
|
|
|
'info' => 'Código do Plano de Contas Referencial que será utilizado ' |
|
60
|
|
|
. 'para o mapeamento de todas as contas analíticas', |
|
61
|
|
|
'format' => '' |
|
62
|
|
|
], |
|
63
|
|
|
'PAT_REMAN_CIS' => [ |
|
64
|
|
|
'type' => 'numeric', |
|
65
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
66
|
|
|
'required' => true, |
|
67
|
|
|
'info' => 'Patrimonio Resmanescente em caso de cisao.', |
|
68
|
|
|
'format' => '8v4' |
|
69
|
|
|
], |
|
70
|
|
|
'DT_INI' => [ |
|
71
|
|
|
'type' => 'string', |
|
72
|
|
|
'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$', |
|
73
|
|
|
'required' => true, |
|
74
|
|
|
'info' => 'Data inicio do periodo.', |
|
75
|
|
|
'format' => '' |
|
76
|
|
|
], |
|
77
|
|
|
'DT_FIN' => [ |
|
78
|
|
|
'type' => 'string', |
|
79
|
|
|
'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$', |
|
80
|
|
|
'required' => true, |
|
81
|
|
|
'info' => 'Data final das informações contidas no arquivo.', |
|
82
|
|
|
'format' => '' |
|
83
|
|
|
], |
|
84
|
|
|
'RETIFICADORA' => [ |
|
85
|
|
|
'type' => 'string', |
|
86
|
|
|
'regex' => '^(S|N|F)$', |
|
87
|
|
|
'required' => true, |
|
88
|
|
|
'info' => 'Escritora Retificadora.', |
|
89
|
|
|
'format' => '' |
|
90
|
|
|
], |
|
91
|
|
|
'NUM_REC' => [ |
|
92
|
|
|
'type' => 'string', |
|
93
|
|
|
'regex' => '^.{0,41}$', |
|
94
|
|
|
'required' => false, |
|
95
|
|
|
'info' => 'Hash do numero do recibo da escrituração anterior.', |
|
96
|
|
|
'format' => '' |
|
97
|
|
|
], |
|
98
|
|
|
'TIP_ECF' => [ |
|
99
|
|
|
'type' => 'numeric', |
|
100
|
|
|
'regex' => '^(0|1|2)$', |
|
101
|
|
|
'required' => true, |
|
102
|
|
|
'info' => 'Indicador de tipo de ecf', |
|
103
|
|
|
'format' => '' |
|
104
|
|
|
], |
|
105
|
|
|
'COD_SCP' => [ |
|
106
|
|
|
'type' => 'string', |
|
107
|
|
|
'regex' => '^[0-9]{14}$', |
|
108
|
|
|
'required' => false, |
|
109
|
|
|
'info' => 'Número de inscrição da entidade no CNPJ.', |
|
110
|
|
|
'format' => '' |
|
111
|
|
|
] |
|
112
|
|
|
]; |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* Constructor |
|
116
|
|
|
* @param \stdClass $std |
|
117
|
|
|
*/ |
|
118
|
|
|
public function __construct(\stdClass $std) |
|
119
|
|
|
{ |
|
120
|
|
|
parent::__construct(self::REG); |
|
121
|
|
|
$this->std = $this->standarize($std); |
|
122
|
|
|
$this->postValidation(); |
|
|
|
|
|
|
123
|
|
|
} |
|
124
|
|
|
} |
|
125
|
|
|
|
This check looks for classes that have been defined more than once.
If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.
This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.