|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace NFePHP\eSocial\Factories; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Class eSocial EvtTotConting Event S-1295 constructor |
|
7
|
|
|
* |
|
8
|
|
|
* @category API |
|
9
|
|
|
* @package NFePHPeSocial |
|
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 EvtTotConting extends Factory implements FactoryInterface |
|
25
|
|
|
{ |
|
26
|
|
|
/** |
|
27
|
|
|
* @var int |
|
28
|
|
|
*/ |
|
29
|
|
|
public $sequencial; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var string |
|
33
|
|
|
*/ |
|
34
|
|
|
protected $evtName = 'evtTotConting'; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @var string |
|
38
|
|
|
*/ |
|
39
|
|
|
protected $evtAlias = 'S-1295'; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Parameters patterns |
|
43
|
|
|
* |
|
44
|
|
|
* @var array |
|
45
|
|
|
*/ |
|
46
|
|
|
protected $parameters = []; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* Constructor |
|
50
|
|
|
* |
|
51
|
|
|
* @param string $config |
|
52
|
|
|
* @param stdClass $std |
|
53
|
|
|
* @param Certificate $certificate |
|
54
|
|
|
*/ |
|
55
|
|
|
public function __construct( |
|
56
|
|
|
$config, |
|
57
|
|
|
stdClass $std, |
|
58
|
|
|
Certificate $certificate |
|
59
|
|
|
) { |
|
60
|
|
|
parent::__construct($config, $std, $certificate); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* Node constructor |
|
65
|
|
|
*/ |
|
66
|
|
|
protected function toNode() |
|
67
|
|
|
{ |
|
68
|
|
|
$ideEmpregador = $this->node->getElementsByTagName('ideEmpregador')->item(0); |
|
69
|
|
|
//o idEvento pode variar de evento para evento |
|
70
|
|
|
//então cada factory individualmente terá de construir o seu |
|
71
|
|
|
$ideEvento = $this->dom->createElement("ideEvento"); |
|
72
|
|
|
$this->dom->addChild( |
|
73
|
|
|
$ideEvento, |
|
74
|
|
|
"indApuracao", |
|
75
|
|
|
$this->std->indapuracao, |
|
76
|
|
|
true |
|
77
|
|
|
); |
|
78
|
|
|
$this->dom->addChild( |
|
79
|
|
|
$ideEvento, |
|
80
|
|
|
"perApur", |
|
81
|
|
|
$this->std->perapur, |
|
82
|
|
|
true |
|
83
|
|
|
); |
|
84
|
|
|
$this->dom->addChild( |
|
85
|
|
|
$ideEvento, |
|
86
|
|
|
"tpAmb", |
|
87
|
|
|
$this->tpAmb, |
|
88
|
|
|
true |
|
89
|
|
|
); |
|
90
|
|
|
$this->dom->addChild( |
|
91
|
|
|
$ideEvento, |
|
92
|
|
|
"procEmi", |
|
93
|
|
|
$this->procEmi, |
|
94
|
|
|
true |
|
95
|
|
|
); |
|
96
|
|
|
$this->dom->addChild( |
|
97
|
|
|
$ideEvento, |
|
98
|
|
|
"verProc", |
|
99
|
|
|
$this->verProc, |
|
100
|
|
|
true |
|
101
|
|
|
); |
|
102
|
|
|
$this->node->insertBefore($ideEvento, $ideEmpregador); |
|
103
|
|
|
|
|
104
|
|
|
$ide = $this->dom->createElement("ideRespInf"); |
|
105
|
|
|
$this->dom->addChild( |
|
106
|
|
|
$ide, |
|
107
|
|
|
"nmResp", |
|
108
|
|
|
$this->std->nmresp, |
|
109
|
|
|
true |
|
110
|
|
|
); |
|
111
|
|
|
$this->dom->addChild( |
|
112
|
|
|
$ide, |
|
113
|
|
|
"cpfResp", |
|
114
|
|
|
$this->std->cpfresp, |
|
115
|
|
|
true |
|
116
|
|
|
); |
|
117
|
|
|
$this->dom->addChild( |
|
118
|
|
|
$ide, |
|
119
|
|
|
"telefone", |
|
120
|
|
|
$this->std->telefone, |
|
121
|
|
|
true |
|
122
|
|
|
); |
|
123
|
|
|
$this->dom->addChild( |
|
124
|
|
|
$ide, |
|
125
|
|
|
"email", |
|
126
|
|
|
! empty($this->std->email) ? $this->std->email : null, |
|
127
|
|
|
false |
|
128
|
|
|
); |
|
129
|
|
|
$this->node->appendChild($ide); |
|
130
|
|
|
$this->eSocial->appendChild($this->node); |
|
131
|
|
|
//$this->xml = $this->dom->saveXML($this->eSocial); |
|
|
|
|
|
|
132
|
|
|
$this->sign(); |
|
133
|
|
|
} |
|
134
|
|
|
} |
|
135
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.