|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace NFePHP\EFD\Elements\Contribuicoes; |
|
4
|
|
|
|
|
5
|
|
|
use NFePHP\EFD\Common\Element; |
|
6
|
|
|
use NFePHP\EFD\Common\ElementInterface; |
|
7
|
|
|
use \stdClass; |
|
8
|
|
|
|
|
9
|
|
View Code Duplication |
class A120 extends Element implements ElementInterface |
|
|
|
|
|
|
10
|
|
|
{ |
|
11
|
|
|
const REG = 'A120'; |
|
12
|
|
|
const LEVEL = 4; |
|
13
|
|
|
const PARENT = 'A120'; |
|
14
|
|
|
|
|
15
|
|
|
protected $parameters = [ |
|
16
|
|
|
'VL_TOT_SERV' => [ |
|
17
|
|
|
'type' => 'numeric', |
|
18
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
19
|
|
|
'required' => false, |
|
20
|
|
|
'info' => 'Valor total do serviço, prestado por pessoa física ou jurídica domiciliada no exterior.', |
|
21
|
|
|
'format' => '15v2' |
|
22
|
|
|
], |
|
23
|
|
|
'VL_BC_PIS' => [ |
|
24
|
|
|
'type' => 'numeric', |
|
25
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
26
|
|
|
'required' => false, |
|
27
|
|
|
'info' => 'Valor da base de cálculo da Operação – PIS/PASEP – Importação', |
|
28
|
|
|
'format' => '15v2' |
|
29
|
|
|
], |
|
30
|
|
|
'VL_PIS_IMP' => [ |
|
31
|
|
|
'type' => 'numeric', |
|
32
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
33
|
|
|
'required' => false, |
|
34
|
|
|
'info' => 'Valor pago/recolhido de PIS/PASEP – Importação', |
|
35
|
|
|
'format' => '15v2' |
|
36
|
|
|
], |
|
37
|
|
|
'DT_PAG_PIS' => [ |
|
38
|
|
|
'type' => 'string', |
|
39
|
|
|
'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$', |
|
40
|
|
|
'required' => false, |
|
41
|
|
|
'info' => 'Data de pagamento do PIS/PASEP – Importação', |
|
42
|
|
|
'format' => '' |
|
43
|
|
|
], |
|
44
|
|
|
'VL_BC_COFINS' => [ |
|
45
|
|
|
'type' => 'numeric', |
|
46
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
47
|
|
|
'required' => false, |
|
48
|
|
|
'info' => 'Valor da base de cálculo da Operação – COFINS – Importação', |
|
49
|
|
|
'format' => '15v2' |
|
50
|
|
|
], |
|
51
|
|
|
'VL_COFINS_IMP' => [ |
|
52
|
|
|
'type' => 'numeric', |
|
53
|
|
|
'regex' => '^\d+(\.\d*)?|\.\d+$', |
|
54
|
|
|
'required' => false, |
|
55
|
|
|
'info' => 'Valor pago/recolhido de COFINS – Importação', |
|
56
|
|
|
'format' => '15v2' |
|
57
|
|
|
], |
|
58
|
|
|
'DT_PAG_COFINS' => [ |
|
59
|
|
|
'type' => 'string', |
|
60
|
|
|
'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$', |
|
61
|
|
|
'required' => false, |
|
62
|
|
|
'info' => 'Data de pagamento do COFINS – Importação', |
|
63
|
|
|
'format' => '' |
|
64
|
|
|
], |
|
65
|
|
|
'LOC_EXE_SERV' => [ |
|
66
|
|
|
'type' => 'string', |
|
67
|
|
|
'regex' => '^.{1}$', |
|
68
|
|
|
'required' => false, |
|
69
|
|
|
'info' => 'Local da execução do serviço: |
|
70
|
|
|
0 – Executado no País; |
|
71
|
|
|
1 – Executado no Exterior, cujo resultado se verifique no País.', |
|
72
|
|
|
'format' => '' |
|
73
|
|
|
], |
|
74
|
|
|
|
|
75
|
|
|
]; |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* Constructor |
|
79
|
|
|
* @param \stdClass $std |
|
80
|
|
|
*/ |
|
81
|
|
|
public function __construct(\stdClass $std) |
|
82
|
|
|
{ |
|
83
|
|
|
parent::__construct(self::REG); |
|
84
|
|
|
$this->std = $this->standarize($std); |
|
85
|
|
|
} |
|
86
|
|
|
} |
|
87
|
|
|
|
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.