1 | <?php |
||
16 | abstract class Factory |
||
17 | { |
||
18 | /** |
||
19 | * @var int |
||
20 | */ |
||
21 | public $tpInsc; |
||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | public $nrInsc; |
||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | public $nmRazao; |
||
30 | /** |
||
31 | * @var DateTime |
||
32 | */ |
||
33 | public $date; |
||
34 | /** |
||
35 | * @var int |
||
36 | */ |
||
37 | public $tpAmb; |
||
38 | /** |
||
39 | * @var int |
||
40 | */ |
||
41 | public $procEmi = 1; //1- Aplicativo do empregador |
||
42 | /** |
||
43 | * @var string |
||
44 | */ |
||
45 | public $verProc; |
||
46 | /** |
||
47 | * @var string |
||
48 | */ |
||
49 | public $layout; |
||
50 | /** |
||
51 | * @var string |
||
52 | */ |
||
53 | public $layoutStr; |
||
54 | /** |
||
55 | * @var string |
||
56 | */ |
||
57 | public $schema; |
||
58 | /** |
||
59 | * @var string |
||
60 | */ |
||
61 | public $jsonschema; |
||
62 | /** |
||
63 | * @var string |
||
64 | */ |
||
65 | public $evtid; |
||
66 | /** |
||
67 | * @var string |
||
68 | */ |
||
69 | protected $xmlns = "http://www.esocial.gov.br/schema/evt/"; |
||
70 | /** |
||
71 | * @var Dom |
||
72 | */ |
||
73 | protected $dom; |
||
74 | /** |
||
75 | * @var stdClass |
||
76 | */ |
||
77 | protected $std; |
||
78 | /** |
||
79 | * @var string |
||
80 | */ |
||
81 | protected $xml; |
||
82 | /** |
||
83 | * @var DOMElement |
||
84 | */ |
||
85 | protected $eSocial; |
||
86 | /** |
||
87 | * @var DOMElement |
||
88 | */ |
||
89 | protected $node; |
||
90 | /** |
||
91 | * @var array |
||
92 | */ |
||
93 | protected $parameters = []; |
||
94 | /** |
||
95 | * @var string |
||
96 | */ |
||
97 | protected $evtName; |
||
98 | /** |
||
99 | * @var string |
||
100 | */ |
||
101 | protected $evtAlias; |
||
102 | /** |
||
103 | * @var Certificate | null |
||
104 | */ |
||
105 | protected $certificate; |
||
106 | |||
107 | /** |
||
108 | * Constructor |
||
109 | * @param string $config |
||
110 | * @param stdClass $std |
||
111 | * @param Certificate $certificate | null |
||
112 | * @param string $date |
||
113 | */ |
||
114 | 5 | public function __construct( |
|
167 | |||
168 | /** |
||
169 | * Stringfy layout number |
||
170 | * @param string $layout |
||
171 | * @return string |
||
172 | */ |
||
173 | 5 | protected function strLayoutVer($layout) |
|
182 | |||
183 | /** |
||
184 | * Change properties names of stdClass to lower case |
||
185 | * @param stdClass $data |
||
186 | * @return stdClass |
||
187 | */ |
||
188 | 5 | protected static function propertiesToLower(stdClass $data) |
|
201 | |||
202 | /** |
||
203 | * Validation json data from json Schema |
||
204 | * @param stdClass $data |
||
205 | * @return boolean |
||
206 | * @throws \RuntimeException |
||
207 | */ |
||
208 | 5 | protected function validInputData($data) |
|
225 | |||
226 | /** |
||
227 | * Initialize DOM |
||
228 | */ |
||
229 | 5 | protected function init() |
|
269 | |||
270 | /** |
||
271 | * Returns alias for event |
||
272 | * @return string |
||
273 | */ |
||
274 | public function alias() |
||
278 | |||
279 | /** |
||
280 | * Returns Certificate::class |
||
281 | * @return Certificate|null |
||
282 | */ |
||
283 | public function getCertificate() |
||
287 | |||
288 | /** |
||
289 | * Set Certificate::class |
||
290 | * @param Certificate $certificate |
||
291 | */ |
||
292 | public function setCertificate(Certificate $certificate) |
||
296 | |||
297 | /** |
||
298 | * Return xml of event |
||
299 | * @return string |
||
300 | */ |
||
301 | 1 | public function toXML() |
|
309 | |||
310 | abstract protected function toNode(); |
||
311 | |||
312 | /** |
||
313 | * Remove XML declaration from XML string |
||
314 | * @param string $xml |
||
315 | * @return string |
||
316 | */ |
||
317 | 1 | protected function clearXml($xml) |
|
325 | |||
326 | /** |
||
327 | * Convert xml of event to array |
||
328 | * @return array |
||
329 | */ |
||
330 | 1 | public function toArray() |
|
334 | |||
335 | /** |
||
336 | * Convert xml to json string |
||
337 | * @return string |
||
338 | */ |
||
339 | 2 | public function toJson() |
|
343 | |||
344 | /** |
||
345 | * Returns stdClass |
||
346 | * @return stdClass |
||
347 | */ |
||
348 | 1 | public function toStd() |
|
352 | |||
353 | /** |
||
354 | * Adjust missing properties form original data according schema |
||
355 | * @param \stdClass $data |
||
356 | * @return \stdClass |
||
357 | */ |
||
358 | public function standardizeProperties(stdClass $data) |
||
367 | |||
368 | /** |
||
369 | * Sign and validate XML with XSD, can throw Exception |
||
370 | */ |
||
371 | 1 | protected function sign() |
|
389 | } |
||
390 |
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.