Conditions | 84 |
Paths | > 20000 |
Total Lines | 980 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
10 | protected function toNode250() |
||
11 | { |
||
12 | $ideEmpregador = $this->node->getElementsByTagName('ideEmpregador')->item(0); |
||
|
|||
13 | $ideEvento = $this->dom->createElement("ideEvento"); |
||
14 | $this->dom->addChild( |
||
15 | $ideEvento, |
||
16 | "indRetif", |
||
17 | $this->std->indretif, |
||
18 | true |
||
19 | ); |
||
20 | $this->dom->addChild( |
||
21 | $ideEvento, |
||
22 | "nrRecibo", |
||
23 | ! empty($this->std->nrrecibo) ? $this->std->nrrecibo : null, |
||
24 | false |
||
25 | ); |
||
26 | $this->dom->addChild( |
||
27 | $ideEvento, |
||
28 | "tpAmb", |
||
29 | $this->tpAmb, |
||
30 | true |
||
31 | ); |
||
32 | $this->dom->addChild( |
||
33 | $ideEvento, |
||
34 | "procEmi", |
||
35 | $this->procEmi, |
||
36 | true |
||
37 | ); |
||
38 | $this->dom->addChild( |
||
39 | $ideEvento, |
||
40 | "verProc", |
||
41 | $this->verProc, |
||
42 | true |
||
43 | ); |
||
44 | $this->node->insertBefore($ideEvento, $ideEmpregador); |
||
45 | $trabalhador = $this->dom->createElement("trabalhador"); |
||
46 | $this->dom->addChild( |
||
47 | $trabalhador, |
||
48 | "cpfTrab", |
||
49 | $this->std->cpftrab, |
||
50 | true |
||
51 | ); |
||
52 | $this->dom->addChild( |
||
53 | $trabalhador, |
||
54 | "nisTrab", |
||
55 | !empty($this->std->nistrab) ? $this->std->nistrab : null, |
||
56 | false |
||
57 | ); |
||
58 | $this->dom->addChild( |
||
59 | $trabalhador, |
||
60 | "nmTrab", |
||
61 | $this->std->nmtrab, |
||
62 | true |
||
63 | ); |
||
64 | $this->dom->addChild( |
||
65 | $trabalhador, |
||
66 | "sexo", |
||
67 | $this->std->sexo, |
||
68 | true |
||
69 | ); |
||
70 | $this->dom->addChild( |
||
71 | $trabalhador, |
||
72 | "racaCor", |
||
73 | $this->std->racacor, |
||
74 | true |
||
75 | ); |
||
76 | $this->dom->addChild( |
||
77 | $trabalhador, |
||
78 | "estCiv", |
||
79 | !empty($this->std->estciv) ? $this->std->estciv : null, |
||
80 | false |
||
81 | ); |
||
82 | $this->dom->addChild( |
||
83 | $trabalhador, |
||
84 | "grauInstr", |
||
85 | $this->std->grauinstr, |
||
86 | true |
||
87 | ); |
||
88 | $this->dom->addChild( |
||
89 | $trabalhador, |
||
90 | "nmSoc", |
||
91 | !empty($this->std->nmsoc) ? $this->std->nmsoc : null, |
||
92 | false |
||
93 | ); |
||
94 | $nascimento = $this->dom->createElement("nascimento"); |
||
95 | $this->dom->addChild( |
||
96 | $nascimento, |
||
97 | "dtNascto", |
||
98 | $this->std->dtnascto, |
||
99 | true |
||
100 | ); |
||
101 | $this->dom->addChild( |
||
102 | $nascimento, |
||
103 | "codMunic", |
||
104 | !empty($this->std->codmunic) ? $this->std->codmunic : null, |
||
105 | false |
||
106 | ); |
||
107 | $this->dom->addChild( |
||
108 | $nascimento, |
||
109 | "uf", |
||
110 | !empty($this->std->uf) ? $this->std->uf : null, |
||
111 | false |
||
112 | ); |
||
113 | $this->dom->addChild( |
||
114 | $nascimento, |
||
115 | "paisNascto", |
||
116 | $this->std->paisnascto, |
||
117 | true |
||
118 | ); |
||
119 | $this->dom->addChild( |
||
120 | $nascimento, |
||
121 | "paisNac", |
||
122 | $this->std->paisnac, |
||
123 | true |
||
124 | ); |
||
125 | $this->dom->addChild( |
||
126 | $nascimento, |
||
127 | "nmMae", |
||
128 | !empty($this->std->nmmae) ? $this->std->nmmae : null, |
||
129 | false |
||
130 | ); |
||
131 | $this->dom->addChild( |
||
132 | $nascimento, |
||
133 | "nmPai", |
||
134 | !empty($this->std->nmpai) ? $this->std->nmpai : null, |
||
135 | false |
||
136 | ); |
||
137 | $trabalhador->appendChild($nascimento); |
||
138 | |||
139 | $documentos = null; |
||
140 | if (!empty($this->std->ctps)) { |
||
141 | $doc = $this->std->ctps; |
||
142 | $documentos = $this->dom->createElement("documentos"); |
||
143 | $ctps = $this->dom->createElement("CTPS"); |
||
144 | $this->dom->addChild( |
||
145 | $ctps, |
||
146 | "nrCtps", |
||
147 | $doc->nrctps, |
||
148 | true |
||
149 | ); |
||
150 | $this->dom->addChild( |
||
151 | $ctps, |
||
152 | "serieCtps", |
||
153 | $doc->seriectps, |
||
154 | true |
||
155 | ); |
||
156 | $this->dom->addChild( |
||
157 | $ctps, |
||
158 | "ufCtps", |
||
159 | $doc->ufctps, |
||
160 | true |
||
161 | ); |
||
162 | $documentos->appendChild($ctps); |
||
163 | } |
||
164 | |||
165 | if (!empty($this->std->ric)) { |
||
166 | $doc = $this->std->ric; |
||
167 | if (empty($documentos)) { |
||
168 | $documentos = $this->dom->createElement("documentos"); |
||
169 | } |
||
170 | $ric = $this->dom->createElement("RIC"); |
||
171 | $this->dom->addChild( |
||
172 | $ric, |
||
173 | "nrRic", |
||
174 | $doc->nrric, |
||
175 | true |
||
176 | ); |
||
177 | $this->dom->addChild( |
||
178 | $ric, |
||
179 | "orgaoEmissor", |
||
180 | $doc->orgaoemissor, |
||
181 | true |
||
182 | ); |
||
183 | $this->dom->addChild( |
||
184 | $ric, |
||
185 | "dtExped", |
||
186 | !empty($doc->dtexped) ? $doc->dtexped : null, |
||
187 | false |
||
188 | ); |
||
189 | $documentos->appendChild($ric); |
||
190 | } |
||
191 | |||
192 | if (!empty($this->std->rg)) { |
||
193 | $doc = $this->std->rg; |
||
194 | if (empty($documentos)) { |
||
195 | $documentos = $this->dom->createElement("documentos"); |
||
196 | } |
||
197 | $rg = $this->dom->createElement("RG"); |
||
198 | $this->dom->addChild( |
||
199 | $rg, |
||
200 | "nrRg", |
||
201 | $doc->nrrg, |
||
202 | true |
||
203 | ); |
||
204 | $this->dom->addChild( |
||
205 | $rg, |
||
206 | "orgaoEmissor", |
||
207 | $doc->orgaoemissor, |
||
208 | true |
||
209 | ); |
||
210 | $this->dom->addChild( |
||
211 | $rg, |
||
212 | "dtExped", |
||
213 | !empty($doc->dtexped) ? $doc->dtexped : null, |
||
214 | false |
||
215 | ); |
||
216 | $documentos->appendChild($rg); |
||
217 | } |
||
218 | |||
219 | if (!empty($this->std->rne)) { |
||
220 | $doc = $this->std->rne; |
||
221 | if (empty($documentos)) { |
||
222 | $documentos = $this->dom->createElement("documentos"); |
||
223 | } |
||
224 | $rne = $this->dom->createElement("RNE"); |
||
225 | $this->dom->addChild( |
||
226 | $rne, |
||
227 | "nrRne", |
||
228 | $doc->nrrne, |
||
229 | true |
||
230 | ); |
||
231 | $this->dom->addChild( |
||
232 | $rne, |
||
233 | "orgaoEmissor", |
||
234 | $doc->orgaoemissor, |
||
235 | true |
||
236 | ); |
||
237 | $this->dom->addChild( |
||
238 | $rne, |
||
239 | "dtExped", |
||
240 | !empty($doc->dtexped) ? $doc->dtexped : null, |
||
241 | false |
||
242 | ); |
||
243 | $documentos->appendChild($rne); |
||
244 | } |
||
245 | |||
246 | if (!empty($this->std->oc)) { |
||
247 | $doc = $this->std->oc; |
||
248 | if (empty($documentos)) { |
||
249 | $documentos = $this->dom->createElement("documentos"); |
||
250 | } |
||
251 | $oc = $this->dom->createElement("OC"); |
||
252 | $this->dom->addChild( |
||
253 | $oc, |
||
254 | "nrOc", |
||
255 | $doc->nroc, |
||
256 | true |
||
257 | ); |
||
258 | $this->dom->addChild( |
||
259 | $oc, |
||
260 | "orgaoEmissor", |
||
261 | $doc->orgaoemissor, |
||
262 | true |
||
263 | ); |
||
264 | $this->dom->addChild( |
||
265 | $oc, |
||
266 | "dtExped", |
||
267 | !empty($doc->dtexped) ? $doc->dtexped : null, |
||
268 | false |
||
269 | ); |
||
270 | $this->dom->addChild( |
||
271 | $oc, |
||
272 | "dtValid", |
||
273 | !empty($doc->dtvalid) ? $doc->dtvalid : null, |
||
274 | false |
||
275 | ); |
||
276 | $documentos->appendChild($oc); |
||
277 | } |
||
278 | |||
279 | if (!empty($this->std->cnh)) { |
||
280 | $doc = $this->std->cnh; |
||
281 | if (empty($documentos)) { |
||
282 | $documentos = $this->dom->createElement("documentos"); |
||
283 | } |
||
284 | $cnh = $this->dom->createElement("CNH"); |
||
285 | $this->dom->addChild( |
||
286 | $cnh, |
||
287 | "nrRegCnh", |
||
288 | $doc->nrregcnh, |
||
289 | true |
||
290 | ); |
||
291 | $this->dom->addChild( |
||
292 | $cnh, |
||
293 | "dtExped", |
||
294 | !empty($doc->dtexped) ? $doc->dtexped : null, |
||
295 | false |
||
296 | ); |
||
297 | $this->dom->addChild( |
||
298 | $cnh, |
||
299 | "ufCnh", |
||
300 | $doc->ufcnh, |
||
301 | true |
||
302 | ); |
||
303 | $this->dom->addChild( |
||
304 | $cnh, |
||
305 | "dtValid", |
||
306 | $doc->dtvalid, |
||
307 | true |
||
308 | ); |
||
309 | $this->dom->addChild( |
||
310 | $cnh, |
||
311 | "dtPriHab", |
||
312 | !empty($doc->dtprihab) ? $doc->dtprihab : null, |
||
313 | false |
||
314 | ); |
||
315 | $this->dom->addChild( |
||
316 | $cnh, |
||
317 | "categoriaCnh", |
||
318 | $doc->categoriacnh, |
||
319 | true |
||
320 | ); |
||
321 | $documentos->appendChild($cnh); |
||
322 | } |
||
323 | |||
324 | if (!empty($documentos)) { |
||
325 | $trabalhador->appendChild($documentos); |
||
326 | } |
||
327 | |||
328 | $endereco = $this->dom->createElement("endereco"); |
||
329 | if (!empty($this->std->brasil)) { |
||
330 | $end = $this->std->brasil; |
||
331 | $brasil = $this->dom->createElement("brasil"); |
||
332 | $this->dom->addChild( |
||
333 | $brasil, |
||
334 | "tpLograd", |
||
335 | $end->tplograd, |
||
336 | true |
||
337 | ); |
||
338 | $this->dom->addChild( |
||
339 | $brasil, |
||
340 | "dscLograd", |
||
341 | $end->dsclograd, |
||
342 | true |
||
343 | ); |
||
344 | $this->dom->addChild( |
||
345 | $brasil, |
||
346 | "nrLograd", |
||
347 | $end->nrlograd, |
||
348 | true |
||
349 | ); |
||
350 | $this->dom->addChild( |
||
351 | $brasil, |
||
352 | "complemento", |
||
353 | !empty($end->complemento) ? $end->complemento : null, |
||
354 | false |
||
355 | ); |
||
356 | $this->dom->addChild( |
||
357 | $brasil, |
||
358 | "bairro", |
||
359 | !empty($end->bairro) ? $end->bairro : null, |
||
360 | false |
||
361 | ); |
||
362 | $this->dom->addChild( |
||
363 | $brasil, |
||
364 | "cep", |
||
365 | $end->cep, |
||
366 | true |
||
367 | ); |
||
368 | $this->dom->addChild( |
||
369 | $brasil, |
||
370 | "codMunic", |
||
371 | $end->codmunic, |
||
372 | true |
||
373 | ); |
||
374 | $this->dom->addChild( |
||
375 | $brasil, |
||
376 | "uf", |
||
377 | $end->uf, |
||
378 | true |
||
379 | ); |
||
380 | $endereco->appendChild($brasil); |
||
381 | } elseif (!empty($this->std->exterior)) { |
||
382 | $end = $this->std->exterior; |
||
383 | $exterior = $this->dom->createElement("exterior"); |
||
384 | $this->dom->addChild( |
||
385 | $exterior, |
||
386 | "paisResid", |
||
387 | $end->paisresid, |
||
388 | true |
||
389 | ); |
||
390 | $this->dom->addChild( |
||
391 | $exterior, |
||
392 | "dscLograd", |
||
393 | $end->dsclograd, |
||
394 | true |
||
395 | ); |
||
396 | $this->dom->addChild( |
||
397 | $exterior, |
||
398 | "nrLograd", |
||
399 | $end->nrlograd, |
||
400 | true |
||
401 | ); |
||
402 | $this->dom->addChild( |
||
403 | $exterior, |
||
404 | "complemento", |
||
405 | !empty($end->complemento) ? $end->complemento : null, |
||
406 | false |
||
407 | ); |
||
408 | $this->dom->addChild( |
||
409 | $exterior, |
||
410 | "bairro", |
||
411 | !empty($end->bairro) ? $end->bairro : null, |
||
412 | false |
||
413 | ); |
||
414 | $this->dom->addChild( |
||
415 | $exterior, |
||
416 | "nmCid", |
||
417 | $end->nmcid, |
||
418 | true |
||
419 | ); |
||
420 | $this->dom->addChild( |
||
421 | $exterior, |
||
422 | "codPostal", |
||
423 | !empty($end->codpostal) ? $end->codpostal : null, |
||
424 | false |
||
425 | ); |
||
426 | $endereco->appendChild($exterior); |
||
427 | } |
||
428 | $trabalhador->appendChild($endereco); |
||
429 | |||
430 | if (!empty($this->std->trabestrangeiro)) { |
||
431 | $trabEstrangeiro = $this->dom->createElement("trabEstrangeiro"); |
||
432 | $this->dom->addChild( |
||
433 | $trabEstrangeiro, |
||
434 | "dtChegada", |
||
435 | !empty($this->std->trabestrangeiro->dtchegada) ? $this->std->trabestrangeiro->dtchegada : null, |
||
436 | false |
||
437 | ); |
||
438 | $this->dom->addChild( |
||
439 | $trabEstrangeiro, |
||
440 | "classTrabEstrang", |
||
441 | $this->std->trabestrangeiro->classtrabestrang, |
||
442 | true |
||
443 | ); |
||
444 | $this->dom->addChild( |
||
445 | $trabEstrangeiro, |
||
446 | "casadoBr", |
||
447 | $this->std->trabestrangeiro->casadobr, |
||
448 | true |
||
449 | ); |
||
450 | $this->dom->addChild( |
||
451 | $trabEstrangeiro, |
||
452 | "filhosBr", |
||
453 | $this->std->trabestrangeiro->filhosbr, |
||
454 | true |
||
455 | ); |
||
456 | $trabalhador->appendChild($trabEstrangeiro); |
||
457 | } |
||
458 | |||
459 | if (!empty($this->std->infodeficiencia)) { |
||
460 | $def = $this->std->infodeficiencia; |
||
461 | $infoDeficiencia = $this->dom->createElement("infoDeficiencia"); |
||
462 | $this->dom->addChild( |
||
463 | $infoDeficiencia, |
||
464 | "defFisica", |
||
465 | $def->deffisica, |
||
466 | true |
||
467 | ); |
||
468 | $this->dom->addChild( |
||
469 | $infoDeficiencia, |
||
470 | "defVisual", |
||
471 | $def->defvisual, |
||
472 | true |
||
473 | ); |
||
474 | $this->dom->addChild( |
||
475 | $infoDeficiencia, |
||
476 | "defAuditiva", |
||
477 | $def->defauditiva, |
||
478 | true |
||
479 | ); |
||
480 | $this->dom->addChild( |
||
481 | $infoDeficiencia, |
||
482 | "defMental", |
||
483 | $def->defmental, |
||
484 | true |
||
485 | ); |
||
486 | $this->dom->addChild( |
||
487 | $infoDeficiencia, |
||
488 | "defIntelectual", |
||
489 | $def->defintelectual, |
||
490 | true |
||
491 | ); |
||
492 | $this->dom->addChild( |
||
493 | $infoDeficiencia, |
||
494 | "reabReadap", |
||
495 | $def->reabreadap, |
||
496 | true |
||
497 | ); |
||
498 | $this->dom->addChild( |
||
499 | $infoDeficiencia, |
||
500 | "observacao", |
||
501 | !empty($def->observacao) ? $def->observacao : null, |
||
502 | false |
||
503 | ); |
||
504 | $trabalhador->appendChild($infoDeficiencia); |
||
505 | } |
||
506 | |||
507 | if (!empty($this->std->dependente)) { |
||
508 | foreach ($this->std->dependente as $dep) { |
||
509 | $dependente = $this->dom->createElement("dependente"); |
||
510 | $this->dom->addChild( |
||
511 | $dependente, |
||
512 | "tpDep", |
||
513 | $dep->tpdep, |
||
514 | true |
||
515 | ); |
||
516 | $this->dom->addChild( |
||
517 | $dependente, |
||
518 | "nmDep", |
||
519 | $dep->nmdep, |
||
520 | true |
||
521 | ); |
||
522 | $this->dom->addChild( |
||
523 | $dependente, |
||
524 | "dtNascto", |
||
525 | $dep->dtnascto, |
||
526 | true |
||
527 | ); |
||
528 | $this->dom->addChild( |
||
529 | $dependente, |
||
530 | "cpfDep", |
||
531 | !empty($dep->cpfdep) ? $dep->cpfdep : null, |
||
532 | false |
||
533 | ); |
||
534 | $this->dom->addChild( |
||
535 | $dependente, |
||
536 | "depIRRF", |
||
537 | $dep->depirrf, |
||
538 | true |
||
539 | ); |
||
540 | $this->dom->addChild( |
||
541 | $dependente, |
||
542 | "depSF", |
||
543 | $dep->depsf, |
||
544 | true |
||
545 | ); |
||
546 | $this->dom->addChild( |
||
547 | $dependente, |
||
548 | "incTrab", |
||
549 | $dep->inctrab, |
||
550 | true |
||
551 | ); |
||
552 | $trabalhador->appendChild($dependente); |
||
553 | } |
||
554 | } |
||
555 | |||
556 | if (!empty($this->std->contato)) { |
||
557 | $con = $this->std->contato; |
||
558 | $contato = $this->dom->createElement("contato"); |
||
559 | $this->dom->addChild( |
||
560 | $contato, |
||
561 | "fonePrinc", |
||
562 | !empty($con->foneprinc) ? $con->foneprinc : null, |
||
563 | false |
||
564 | ); |
||
565 | $this->dom->addChild( |
||
566 | $contato, |
||
567 | "foneAlternat", |
||
568 | !empty($con->fonealternat) ? $con->fonealternat : null, |
||
569 | false |
||
570 | ); |
||
571 | $this->dom->addChild( |
||
572 | $contato, |
||
573 | "emailPrinc", |
||
574 | !empty($con->emailprinc) ? $con->emailprinc : null, |
||
575 | false |
||
576 | ); |
||
577 | $this->dom->addChild( |
||
578 | $contato, |
||
579 | "emailAlternat", |
||
580 | !empty($con->emailalternat) ? $con->emailalternat : null, |
||
581 | false |
||
582 | ); |
||
583 | $trabalhador->appendChild($contato); |
||
584 | } |
||
585 | $this->node->appendChild($trabalhador); |
||
586 | |||
587 | $infoTSVInicio = $this->dom->createElement("infoTSVInicio"); |
||
588 | $ii = $this->std->infotsvinicio; |
||
589 | $this->dom->addChild( |
||
590 | $infoTSVInicio, |
||
591 | "cadIni", |
||
592 | $ii->cadini, |
||
593 | true |
||
594 | ); |
||
595 | $this->dom->addChild( |
||
596 | $infoTSVInicio, |
||
597 | "codCateg", |
||
598 | $ii->codcateg, |
||
599 | true |
||
600 | ); |
||
601 | $this->dom->addChild( |
||
602 | $infoTSVInicio, |
||
603 | "dtInicio", |
||
604 | $ii->dtinicio, |
||
605 | true |
||
606 | ); |
||
607 | $this->dom->addChild( |
||
608 | $infoTSVInicio, |
||
609 | "natAtividade", |
||
610 | !empty($ii->natatividade) ? $ii->natatividade : null, |
||
611 | false |
||
612 | ); |
||
613 | $infoComplementares = null; |
||
614 | if (!empty($this->std->cargofuncao)) { |
||
615 | $infoComplementares = $this->dom->createElement("infoComplementares"); |
||
616 | $rem = $this->std->cargofuncao; |
||
617 | $cargoFuncao = $this->dom->createElement("cargoFuncao"); |
||
618 | $this->dom->addChild( |
||
619 | $cargoFuncao, |
||
620 | "codCargo", |
||
621 | $rem->codcargo, |
||
622 | true |
||
623 | ); |
||
624 | $this->dom->addChild( |
||
625 | $cargoFuncao, |
||
626 | "codFuncao", |
||
627 | !empty($rem->codfuncao) ? $rem->codfuncao : null, |
||
628 | false |
||
629 | ); |
||
630 | $infoComplementares->appendChild($cargoFuncao); |
||
631 | } |
||
632 | |||
633 | if (!empty($this->std->remuneracao)) { |
||
634 | if (empty($infoComplementares)) { |
||
635 | $infoComplementares = $this->dom->createElement("infoComplementares"); |
||
636 | } |
||
637 | $rem = $this->std->remuneracao; |
||
638 | $remuneracao = $this->dom->createElement("remuneracao"); |
||
639 | $this->dom->addChild( |
||
640 | $remuneracao, |
||
641 | "vrSalFx", |
||
642 | $rem->vrsalfx, |
||
643 | true |
||
644 | ); |
||
645 | $this->dom->addChild( |
||
646 | $remuneracao, |
||
647 | "undSalFixo", |
||
648 | $rem->undsalfixo, |
||
649 | true |
||
650 | ); |
||
651 | $this->dom->addChild( |
||
652 | $remuneracao, |
||
653 | "dscSalVar", |
||
654 | !empty($rem->dscsalvar) ? $rem->dscsalvar : null, |
||
655 | false |
||
656 | ); |
||
657 | $infoComplementares->appendChild($remuneracao); |
||
658 | } |
||
659 | |||
660 | if (!empty($this->std->fgts)) { |
||
661 | if (empty($infoComplementares)) { |
||
662 | $infoComplementares = $this->dom->createElement("infoComplementares"); |
||
663 | } |
||
664 | $fg = $this->std->fgts; |
||
665 | $fgts = $this->dom->createElement("fgts"); |
||
666 | $this->dom->addChild( |
||
667 | $fgts, |
||
668 | "opcFGTS", |
||
669 | $fg->opcfgts, |
||
670 | true |
||
671 | ); |
||
672 | $this->dom->addChild( |
||
673 | $fgts, |
||
674 | "dtOpcFGTS", |
||
675 | !empty($fg->dtopcfgts) ? $fg->dtopcfgts : null, |
||
676 | false |
||
677 | ); |
||
678 | $infoComplementares->appendChild($fgts); |
||
679 | } |
||
680 | |||
681 | if (!empty($this->std->infodirigentesindical)) { |
||
682 | if (empty($infoComplementares)) { |
||
683 | $infoComplementares = $this->dom->createElement("infoComplementares"); |
||
684 | } |
||
685 | $sind = $this->std->infodirigentesindical; |
||
686 | $infoDirigenteSindical = $this->dom->createElement("infoDirigenteSindical"); |
||
687 | $this->dom->addChild( |
||
688 | $infoDirigenteSindical, |
||
689 | "categOrig", |
||
690 | $sind->categorig, |
||
691 | true |
||
692 | ); |
||
693 | $this->dom->addChild( |
||
694 | $infoDirigenteSindical, |
||
695 | "cnpjOrigem", |
||
696 | !empty($sind->cnpjorigem) ? $sind->cnpjorigem : null, |
||
697 | false |
||
698 | ); |
||
699 | $this->dom->addChild( |
||
700 | $infoDirigenteSindical, |
||
701 | "dtAdmOrig", |
||
702 | !empty($sind->dtadmorig) ? $sind->dtadmorig : null, |
||
703 | false |
||
704 | ); |
||
705 | $this->dom->addChild( |
||
706 | $infoDirigenteSindical, |
||
707 | "matricOrig", |
||
708 | !empty($sind->matricorig) ? $sind->matricorig : null, |
||
709 | false |
||
710 | ); |
||
711 | $infoComplementares->appendChild($infoDirigenteSindical); |
||
712 | } |
||
713 | |||
714 | if (!empty($this->std->infotrabcedido)) { |
||
715 | if (empty($infoComplementares)) { |
||
716 | $infoComplementares = $this->dom->createElement("infoComplementares"); |
||
717 | } |
||
718 | $infoTrabCedido = $this->dom->createElement("infoTrabCedido"); |
||
719 | $this->dom->addChild( |
||
720 | $infoTrabCedido, |
||
721 | "categOrig", |
||
722 | $this->std->infotrabcedido->categorig, |
||
723 | true |
||
724 | ); |
||
725 | $this->dom->addChild( |
||
726 | $infoTrabCedido, |
||
727 | "cnpjCednt", |
||
728 | $this->std->infotrabcedido->cnpjcednt, |
||
729 | true |
||
730 | ); |
||
731 | $this->dom->addChild( |
||
732 | $infoTrabCedido, |
||
733 | "matricCed", |
||
734 | $this->std->infotrabcedido->matricced, |
||
735 | true |
||
736 | ); |
||
737 | $this->dom->addChild( |
||
738 | $infoTrabCedido, |
||
739 | "dtAdmCed", |
||
740 | $this->std->infotrabcedido->dtadmced, |
||
741 | true |
||
742 | ); |
||
743 | $this->dom->addChild( |
||
744 | $infoTrabCedido, |
||
745 | "tpRegTrab", |
||
746 | $this->std->infotrabcedido->tpregtrab, |
||
747 | true |
||
748 | ); |
||
749 | $this->dom->addChild( |
||
750 | $infoTrabCedido, |
||
751 | "tpRegPrev", |
||
752 | $this->std->infotrabcedido->tpregprev, |
||
753 | true |
||
754 | ); |
||
755 | $this->dom->addChild( |
||
756 | $infoTrabCedido, |
||
757 | "infOnus", |
||
758 | $this->std->infotrabcedido->infonus, |
||
759 | true |
||
760 | ); |
||
761 | $infoComplementares->appendChild($infoTrabCedido); |
||
762 | } |
||
763 | |||
764 | if (!empty($this->std->infoestagiario)) { |
||
765 | $est = $this->std->infoestagiario; |
||
766 | if (empty($infoComplementares)) { |
||
767 | $infoComplementares = $this->dom->createElement("infoComplementares"); |
||
768 | } |
||
769 | $infoEstagiario = $this->dom->createElement("infoEstagiario"); |
||
770 | $this->dom->addChild( |
||
771 | $infoEstagiario, |
||
772 | "natEstagio", |
||
773 | $est->natestagio, |
||
774 | true |
||
775 | ); |
||
776 | $this->dom->addChild( |
||
777 | $infoEstagiario, |
||
778 | "nivEstagio", |
||
779 | $est->nivestagio, |
||
780 | true |
||
781 | ); |
||
782 | $this->dom->addChild( |
||
783 | $infoEstagiario, |
||
784 | "areaAtuacao", |
||
785 | !empty($est->areaatuacao) ? $est->areaatuacao : null, |
||
786 | false |
||
787 | ); |
||
788 | $this->dom->addChild( |
||
789 | $infoEstagiario, |
||
790 | "nrApol", |
||
791 | !empty($est->nrapol) ? $est->nrapol : null, |
||
792 | false |
||
793 | ); |
||
794 | $this->dom->addChild( |
||
795 | $infoEstagiario, |
||
796 | "vlrBolsa", |
||
797 | !empty($est->vlrbolsa) ? $est->vlrbolsa : null, |
||
798 | false |
||
799 | ); |
||
800 | $this->dom->addChild( |
||
801 | $infoEstagiario, |
||
802 | "dtPrevTerm", |
||
803 | $est->dtprevterm, |
||
804 | true |
||
805 | ); |
||
806 | $ens = $est->instensino; |
||
807 | $instEnsino = $this->dom->createElement("instEnsino"); |
||
808 | $this->dom->addChild( |
||
809 | $instEnsino, |
||
810 | "cnpjInstEnsino", |
||
811 | !empty($ens->cnpjinstensino) ? $ens->cnpjinstensino : null, |
||
812 | false |
||
813 | ); |
||
814 | $this->dom->addChild( |
||
815 | $instEnsino, |
||
816 | "nmRazao", |
||
817 | $ens->nmrazao, |
||
818 | true |
||
819 | ); |
||
820 | $this->dom->addChild( |
||
821 | $instEnsino, |
||
822 | "dscLograd", |
||
823 | !empty($ens->dsclograd) ? $ens->dsclograd : null, |
||
824 | false |
||
825 | ); |
||
826 | $this->dom->addChild( |
||
827 | $instEnsino, |
||
828 | "nrLograd", |
||
829 | !empty($ens->nrlograd) ? $ens->nrlograd : null, |
||
830 | false |
||
831 | ); |
||
832 | $this->dom->addChild( |
||
833 | $instEnsino, |
||
834 | "bairro", |
||
835 | !empty($ens->bairro) ? $ens->bairro : null, |
||
836 | false |
||
837 | ); |
||
838 | $this->dom->addChild( |
||
839 | $instEnsino, |
||
840 | "cep", |
||
841 | !empty($ens->cep) ? $ens->cep : null, |
||
842 | false |
||
843 | ); |
||
844 | $this->dom->addChild( |
||
845 | $instEnsino, |
||
846 | "codMunic", |
||
847 | !empty($ens->codmunic) ? $ens->codmunic : null, |
||
848 | false |
||
849 | ); |
||
850 | $this->dom->addChild( |
||
851 | $instEnsino, |
||
852 | "uf", |
||
853 | !empty($ens->uf) ? $ens->uf : null, |
||
854 | false |
||
855 | ); |
||
856 | $infoEstagiario->appendChild($instEnsino); |
||
857 | |||
858 | if (!empty($est->ageintegracao)) { |
||
859 | $agt = $est->ageintegracao; |
||
860 | $ageIntegracao = $this->dom->createElement("ageIntegracao"); |
||
861 | $this->dom->addChild( |
||
862 | $ageIntegracao, |
||
863 | "cnpjAgntInteg", |
||
864 | $agt->cnpjagntinteg, |
||
865 | true |
||
866 | ); |
||
867 | $this->dom->addChild( |
||
868 | $ageIntegracao, |
||
869 | "nmRazao", |
||
870 | $agt->nmrazao, |
||
871 | true |
||
872 | ); |
||
873 | $this->dom->addChild( |
||
874 | $ageIntegracao, |
||
875 | "dscLograd", |
||
876 | $agt->dsclograd, |
||
877 | true |
||
878 | ); |
||
879 | $this->dom->addChild( |
||
880 | $ageIntegracao, |
||
881 | "nrLograd", |
||
882 | $agt->nrlograd, |
||
883 | true |
||
884 | ); |
||
885 | $this->dom->addChild( |
||
886 | $ageIntegracao, |
||
887 | "bairro", |
||
888 | !empty($agt->bairro) ? $agt->bairro : null, |
||
889 | false |
||
890 | ); |
||
891 | $this->dom->addChild( |
||
892 | $ageIntegracao, |
||
893 | "cep", |
||
894 | $agt->cep, |
||
895 | true |
||
896 | ); |
||
897 | $this->dom->addChild( |
||
898 | $ageIntegracao, |
||
899 | "codMunic", |
||
900 | !empty($agt->codmunic) ? $agt->codmunic : null, |
||
901 | false |
||
902 | ); |
||
903 | $this->dom->addChild( |
||
904 | $ageIntegracao, |
||
905 | "uf", |
||
906 | $agt->uf, |
||
907 | true |
||
908 | ); |
||
909 | $infoEstagiario->appendChild($ageIntegracao); |
||
910 | } |
||
911 | if (!empty($est->supervisorestagio)) { |
||
912 | $supervisorEstagio = $this->dom->createElement("supervisorEstagio"); |
||
913 | $this->dom->addChild( |
||
914 | $supervisorEstagio, |
||
915 | "cpfSupervisor", |
||
916 | $est->supervisorestagio->cpfsupervisor, |
||
917 | true |
||
918 | ); |
||
919 | $this->dom->addChild( |
||
920 | $supervisorEstagio, |
||
921 | "nmSuperv", |
||
922 | $est->supervisorestagio->nmsuperv, |
||
923 | true |
||
924 | ); |
||
925 | $infoEstagiario->appendChild($supervisorEstagio); |
||
926 | } |
||
927 | $infoComplementares->appendChild($infoEstagiario); |
||
928 | } |
||
929 | |||
930 | if (!empty($infoComplementares)) { |
||
931 | $infoTSVInicio->appendChild($infoComplementares); |
||
932 | } |
||
933 | if (!empty($this->std->mudancacpf)) { |
||
934 | $mudc = $this->std->mudancacpf; |
||
935 | $mudancaCPF = $this->dom->createElement("mudancaCPF"); |
||
936 | $this->dom->addChild( |
||
937 | $mudancaCPF, |
||
938 | "cpfAnt", |
||
939 | $mudc->cpfant, |
||
940 | true |
||
941 | ); |
||
942 | $this->dom->addChild( |
||
943 | $mudancaCPF, |
||
944 | "dtAltCPF", |
||
945 | $mudc->dtaltcpf, |
||
946 | true |
||
947 | ); |
||
948 | $this->dom->addChild( |
||
949 | $mudancaCPF, |
||
950 | "observacao", |
||
951 | !empty($mudc->observacao) ? $mudc->observacao : null, |
||
952 | false |
||
953 | ); |
||
954 | $infoTSVInicio->appendChild($mudancaCPF); |
||
955 | } |
||
956 | if (!empty($this->std->afastamento)) { |
||
957 | $afastamento = $this->dom->createElement("afastamento"); |
||
958 | $this->dom->addChild( |
||
959 | $afastamento, |
||
960 | "dtIniAfast", |
||
961 | $this->std->afastamento->dtiniafast, |
||
962 | true |
||
963 | ); |
||
964 | $this->dom->addChild( |
||
965 | $afastamento, |
||
966 | "codMotAfast", |
||
967 | $this->std->afastamento->codmotafast, |
||
968 | true |
||
969 | ); |
||
970 | $infoTSVInicio->appendChild($afastamento); |
||
971 | } |
||
972 | |||
973 | if (!empty($this->std->termino)) { |
||
974 | $termino = $this->dom->createElement("termino"); |
||
975 | $this->dom->addChild( |
||
976 | $termino, |
||
977 | "dtTerm", |
||
978 | $this->std->termino->dtterm, |
||
979 | true |
||
980 | ); |
||
981 | $infoTSVInicio->appendChild($termino); |
||
982 | } |
||
983 | |||
984 | $this->node->appendChild($infoTSVInicio); |
||
985 | |||
986 | $this->eSocial->appendChild($this->node); |
||
987 | //$this->xml = $this->dom->saveXML($this->eSocial); |
||
988 | $this->sign(); |
||
989 | } |
||
990 | |||
999 |
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: