1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace NFePHP\eSocial\Factories; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class eSocial EvtExclusao Event S-3000 constructor |
7
|
|
|
* |
8
|
|
|
* @category NFePHP |
9
|
|
|
* @package NFePHPSocial |
10
|
|
|
* @copyright NFePHP Copyright (c) 2017 |
11
|
|
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPLv3+ |
12
|
|
|
* @license https://opensource.org/licenses/MIT MIT |
13
|
|
|
* @license http://www.gnu.org/licenses/gpl.txt GPLv3+ |
14
|
|
|
* @author Roberto L. Machado <linux.rlm at gmail dot com> |
15
|
|
|
* @link http://github.com/nfephp-org/sped-esocial for the canonical source repository |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
use NFePHP\Common\Certificate; |
19
|
|
|
use NFePHP\eSocial\Common\Factory; |
20
|
|
|
use NFePHP\eSocial\Common\FactoryId; |
21
|
|
|
use NFePHP\eSocial\Common\FactoryInterface; |
22
|
|
|
use stdClass; |
23
|
|
|
|
24
|
|
|
class EvtExclusao extends Factory implements FactoryInterface |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* @var int |
28
|
|
|
*/ |
29
|
|
|
public $sequencial; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var string |
33
|
|
|
*/ |
34
|
|
|
protected $evtName = 'evtExclusao'; |
35
|
|
|
/** |
36
|
|
|
* @var string |
37
|
|
|
*/ |
38
|
|
|
protected $evtAlias = 'S-3000'; |
39
|
|
|
/** |
40
|
|
|
* Parameters patterns |
41
|
|
|
* |
42
|
|
|
* @var array |
43
|
|
|
*/ |
44
|
|
|
protected $parameters = []; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Constructor |
48
|
|
|
* |
49
|
|
|
* @param string $config |
50
|
|
|
* @param stdClass $std |
51
|
|
|
* @param Certificate $certificate |
52
|
|
|
*/ |
53
|
|
|
public function __construct( |
54
|
|
|
$config, |
55
|
|
|
stdClass $std, |
56
|
|
|
Certificate $certificate |
57
|
|
|
) { |
58
|
|
|
parent::__construct($config, $std, $certificate); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Node constructor |
63
|
|
|
*/ |
64
|
|
|
protected function toNode() |
65
|
|
|
{ |
66
|
|
|
$evtid = FactoryId::build( |
67
|
|
|
$this->tpInsc, |
68
|
|
|
$this->nrInsc, |
69
|
|
|
$this->date, |
70
|
|
|
$this->sequencial |
71
|
|
|
); |
72
|
|
|
$eSocial = $this->dom->getElementsByTagName("eSocial")->item(0); |
73
|
|
|
$evtExclusao = $this->dom->createElement("evtExclusao"); |
74
|
|
|
$att = $this->dom->createAttribute('Id'); |
75
|
|
|
$att->value = $evtid; |
76
|
|
|
$evtExclusao->appendChild($att); |
77
|
|
|
|
78
|
|
|
$ideEvento = $this->dom->createElement("ideEvento"); |
79
|
|
|
$this->dom->addChild( |
80
|
|
|
$ideEvento, |
81
|
|
|
"tpAmb", |
82
|
|
|
$this->tpAmb, |
83
|
|
|
true |
84
|
|
|
); |
85
|
|
|
$this->dom->addChild( |
86
|
|
|
$ideEvento, |
87
|
|
|
"procEmi", |
88
|
|
|
$this->procEmi, |
89
|
|
|
true |
90
|
|
|
); |
91
|
|
|
$this->dom->addChild( |
92
|
|
|
$ideEvento, |
93
|
|
|
"verProc", |
94
|
|
|
$this->verProc, |
95
|
|
|
true |
96
|
|
|
); |
97
|
|
|
$evtExclusao->appendChild($ideEvento); |
98
|
|
|
|
99
|
|
|
$ideEmpregador = $this->dom->createElement("ideEmpregador"); |
100
|
|
|
$this->dom->addChild( |
101
|
|
|
$ideEmpregador, |
102
|
|
|
"tpInsc", |
103
|
|
|
$this->tpInsc, |
104
|
|
|
true |
105
|
|
|
); |
106
|
|
|
$this->dom->addChild( |
107
|
|
|
$ideEmpregador, |
108
|
|
|
"nrInsc", |
109
|
|
|
$this->nrInsc, |
110
|
|
|
true |
111
|
|
|
); |
112
|
|
|
$evtExclusao->appendChild($ideEmpregador); |
113
|
|
|
|
114
|
|
|
$infoExclusao = $this->dom->createElement("infoExclusao"); |
115
|
|
|
$this->dom->addChild( |
116
|
|
|
$infoExclusao, |
117
|
|
|
"tpEvento", |
118
|
|
|
$this->std->infoexclusao->tpevento, |
119
|
|
|
true |
120
|
|
|
); |
121
|
|
|
$this->dom->addChild( |
122
|
|
|
$infoExclusao, |
123
|
|
|
"nrRecEvt", |
124
|
|
|
$this->std->infoexclusao->nrrecevt, |
125
|
|
|
true |
126
|
|
|
); |
127
|
|
|
if (!empty($this->std->idetrabalhador)) { |
128
|
|
|
$ideTrabalhador = $this->dom->createElement("ideTrabalhador"); |
129
|
|
|
$this->dom->addChild( |
130
|
|
|
$ideTrabalhador, |
131
|
|
|
"cpfTrab", |
132
|
|
|
$this->std->idetrabalhador->cpftrab, |
133
|
|
|
true |
134
|
|
|
); |
135
|
|
|
$this->dom->addChild( |
136
|
|
|
$ideTrabalhador, |
137
|
|
|
"nisTrab", |
138
|
|
|
!empty($this->std->idetrabalhador->nistrab) ? $this->std->idetrabalhador->nistrab : null, |
139
|
|
|
false |
140
|
|
|
); |
141
|
|
|
$infoExclusao->appendChild($ideTrabalhador); |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
|
145
|
|
|
$ideFolhaPagto = $this->dom->createElement("ideFolhaPagto"); |
146
|
|
|
$this->dom->addChild( |
147
|
|
|
$ideFolhaPagto, |
148
|
|
|
"indApuracao", |
149
|
|
|
$this->std->idefolhapagto->indapuracao, |
150
|
|
|
true |
151
|
|
|
); |
152
|
|
|
$this->dom->addChild( |
153
|
|
|
$ideFolhaPagto, |
154
|
|
|
"perApur", |
155
|
|
|
$this->std->idefolhapagto->perapur, |
156
|
|
|
true |
157
|
|
|
); |
158
|
|
|
|
159
|
|
|
$infoExclusao->appendChild($ideFolhaPagto); |
160
|
|
|
|
161
|
|
|
$evtExclusao->appendChild($infoExclusao); |
162
|
|
|
|
163
|
|
|
$eSocial->appendChild($evtExclusao); |
164
|
|
|
$this->sign($eSocial); |
|
|
|
|
165
|
|
|
} |
166
|
|
|
} |
167
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.