1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace NFePHP\eSocial\Factories\Traits; |
4
|
|
|
|
5
|
|
|
trait TraitS3000 |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* builder for version 2.5.0 |
9
|
|
|
*/ |
10
|
|
|
protected function toNode250() |
11
|
|
|
{ |
12
|
|
|
$ideEmpregador = $this->node->getElementsByTagName('ideEmpregador')->item(0); |
|
|
|
|
13
|
|
|
//o idEvento pode variar de evento para evento |
14
|
|
|
//então cada factory individualmente terá de construir o seu |
15
|
|
|
$ideEvento = $this->dom->createElement("ideEvento"); |
|
|
|
|
16
|
|
|
$this->dom->addChild( |
17
|
|
|
$ideEvento, |
18
|
|
|
"tpAmb", |
19
|
|
|
$this->tpAmb, |
|
|
|
|
20
|
|
|
true |
21
|
|
|
); |
22
|
|
|
$this->dom->addChild( |
23
|
|
|
$ideEvento, |
24
|
|
|
"procEmi", |
25
|
|
|
$this->procEmi, |
|
|
|
|
26
|
|
|
true |
27
|
|
|
); |
28
|
|
|
$this->dom->addChild( |
29
|
|
|
$ideEvento, |
30
|
|
|
"verProc", |
31
|
|
|
$this->verProc, |
|
|
|
|
32
|
|
|
true |
33
|
|
|
); |
34
|
|
|
$this->node->insertBefore($ideEvento, $ideEmpregador); |
35
|
|
|
|
36
|
|
|
$infoExclusao = $this->dom->createElement("infoExclusao"); |
37
|
|
|
$this->dom->addChild( |
38
|
|
|
$infoExclusao, |
39
|
|
|
"tpEvento", |
40
|
|
|
$this->std->infoexclusao->tpevento, |
|
|
|
|
41
|
|
|
true |
42
|
|
|
); |
43
|
|
|
$this->dom->addChild( |
44
|
|
|
$infoExclusao, |
45
|
|
|
"nrRecEvt", |
46
|
|
|
$this->std->infoexclusao->nrrecevt, |
47
|
|
|
true |
48
|
|
|
); |
49
|
|
|
if (!empty($this->std->idetrabalhador)) { |
50
|
|
|
$ideTrabalhador = $this->dom->createElement("ideTrabalhador"); |
51
|
|
|
$this->dom->addChild( |
52
|
|
|
$ideTrabalhador, |
53
|
|
|
"cpfTrab", |
54
|
|
|
$this->std->idetrabalhador->cpftrab, |
55
|
|
|
true |
56
|
|
|
); |
57
|
|
|
$this->dom->addChild( |
58
|
|
|
$ideTrabalhador, |
59
|
|
|
"nisTrab", |
60
|
|
|
!empty($this->std->idetrabalhador->nistrab) ? $this->std->idetrabalhador->nistrab : null, |
61
|
|
|
false |
62
|
|
|
); |
63
|
|
|
$infoExclusao->appendChild($ideTrabalhador); |
64
|
|
|
} |
65
|
|
|
if (!empty($this->std->idefolhapagto)) { |
66
|
|
|
$ideFolhaPagto = $this->dom->createElement("ideFolhaPagto"); |
67
|
|
|
$this->dom->addChild( |
68
|
|
|
$ideFolhaPagto, |
69
|
|
|
"indApuracao", |
70
|
|
|
$this->std->idefolhapagto->indapuracao, |
71
|
|
|
true |
72
|
|
|
); |
73
|
|
|
$this->dom->addChild( |
74
|
|
|
$ideFolhaPagto, |
75
|
|
|
"perApur", |
76
|
|
|
$this->std->idefolhapagto->perapur, |
77
|
|
|
true |
78
|
|
|
); |
79
|
|
|
$infoExclusao->appendChild($ideFolhaPagto); |
80
|
|
|
} |
81
|
|
|
$this->node->appendChild($infoExclusao); |
82
|
|
|
$this->eSocial->appendChild($this->node); |
|
|
|
|
83
|
|
|
//$this->xml = $this->dom->saveXML($this->eSocial); |
84
|
|
|
$this->sign(); |
|
|
|
|
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* builder for version S.1.0.0 |
89
|
|
|
*/ |
90
|
|
|
protected function toNodeS100() |
91
|
|
|
{ |
92
|
|
|
throw new \Exception("TODO !!"); |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
|
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: