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 I310 do Bloco I OBRIGATÓRIO [1:1] |
11
|
|
|
* REGISTRO I310: ABERTURA DO ARQUIVO DIGITAL E IDENTIFICAÇÃO DO EMPRESÁRIO OU DA SOCIEDADE EMPRESÁRIA |
12
|
|
|
* |
13
|
|
|
* Alterar campos: val_debd / val_credd / val_deb_mf / val_cred_mf |
14
|
|
|
*/ |
15
|
|
View Code Duplication |
class I310 extends Element implements ElementInterface |
|
|
|
|
16
|
|
|
{ |
17
|
|
|
const REG = 'I310'; |
18
|
|
|
const LEVEL = 4; |
19
|
|
|
const PARENT = ''; |
20
|
|
|
|
21
|
|
|
protected $parameters = [ |
22
|
|
|
'cod_cta' => [ |
23
|
|
|
'type' => 'string', |
24
|
|
|
'regex' => '^[A-Za-z0-9]$', |
25
|
|
|
'required' => true, |
26
|
|
|
'info' => 'Código da conta analítica debitada/creditada.', |
27
|
|
|
'format' => '' |
28
|
|
|
], |
29
|
|
|
'cod_ccus' => [ |
30
|
|
|
'type' => 'string', |
31
|
|
|
'regex' => '^[A-Za-z0-9]$', |
32
|
|
|
'required' => false, |
33
|
|
|
'info' => 'Código do centro de custos.', |
34
|
|
|
'format' => '' |
35
|
|
|
], |
36
|
|
|
'val_debd' => [ |
37
|
|
|
'type' => 'string', |
38
|
|
|
'regex' => '^[0-9]{19}$', |
39
|
|
|
'required' => true, |
40
|
|
|
'info' => 'Total dos débitos do dia.', |
41
|
|
|
'format' => '' |
42
|
|
|
], |
43
|
|
|
'val_credd' => [ |
44
|
|
|
'type' => 'string', |
45
|
|
|
'regex' => '^[0-9]{19}$', |
46
|
|
|
'required' => true, |
47
|
|
|
'info' => 'Total dos créditos do dia.', |
48
|
|
|
'format' => '' |
49
|
|
|
], |
50
|
|
|
'val_deb_mf' => [ |
51
|
|
|
'type' => 'string', |
52
|
|
|
'regex' => '^[0-9]{19}$', |
53
|
|
|
'required' => false, |
54
|
|
|
'info' => 'Total dos débitos do dia em moeda funcional, convertido para reais.', |
55
|
|
|
'format' => '' |
56
|
|
|
], |
57
|
|
|
'val_cred_mf' => [ |
58
|
|
|
'type' => 'string', |
59
|
|
|
'regex' => '^[0-9]{19}$', |
60
|
|
|
'required' => false, |
61
|
|
|
'info' => 'Total dos créditos do dia em moeda funcional, convertido para reais.', |
62
|
|
|
'format' => '' |
63
|
|
|
] |
64
|
|
|
]; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Constructor |
68
|
|
|
* @param \stdClass $std |
69
|
|
|
*/ |
70
|
|
|
public function __construct(\stdClass $std) |
71
|
|
|
{ |
72
|
|
|
parent::__construct(self::REG); |
73
|
|
|
$this->std = $this->standarize($std); |
74
|
|
|
$this->postValidation(); |
|
|
|
|
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.