These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * To change this license header, choose License Headers in Project Properties. |
||
5 | * To change this template file, choose Tools | Templates |
||
6 | * and open the template in the editor. |
||
7 | */ |
||
8 | |||
9 | namespace NFePHP\EFDReinf\Factories; |
||
10 | |||
11 | /** |
||
12 | * Class EFD-Reinf EvtPgtosDivs Event R-2070 constructor |
||
13 | * |
||
14 | * @category API |
||
15 | * @package NFePHP\EFDReinf |
||
16 | * @copyright NFePHP Copyright (c) 2017 |
||
17 | * @license http://www.gnu.org/licenses/lgpl.txt LGPLv3+ |
||
18 | * @license https://opensource.org/licenses/MIT MIT |
||
19 | * @license http://www.gnu.org/licenses/gpl.txt GPLv3+ |
||
20 | * @author Roberto L. Machado <linux.rlm at gmail dot com> |
||
21 | * @link http://github.com/nfephp-org/sped-efdreinf for the canonical source repository |
||
22 | */ |
||
23 | |||
24 | use NFePHP\EFDReinf\Common\Factory; |
||
25 | use NFePHP\EFDReinf\Common\FactoryInterface; |
||
26 | use NFePHP\EFDReinf\Common\FactoryId; |
||
27 | use NFePHP\Common\Certificate; |
||
28 | use stdClass; |
||
29 | |||
30 | class EvtPgtosDivs extends Factory implements FactoryInterface |
||
31 | { |
||
32 | /** |
||
33 | * Constructor |
||
34 | * @param string $config |
||
35 | * @param stdClass $std |
||
36 | * @param Certificate $certificate |
||
37 | * @param string $data |
||
38 | */ |
||
39 | public function __construct( |
||
40 | $config, |
||
41 | stdClass $std, |
||
42 | Certificate $certificate = null, |
||
43 | $data = '' |
||
44 | ) { |
||
45 | $params = new \stdClass(); |
||
46 | $params->evtName = 'evtPagtoDivs'; |
||
47 | $params->evtTag = 'evtPgtosDivs'; |
||
48 | $params->evtAlias = 'R-2070'; |
||
49 | parent::__construct($config, $std, $params, $certificate, $data); |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * Node constructor |
||
54 | */ |
||
55 | protected function toNode() |
||
56 | { |
||
57 | $ideContri = $this->node->getElementsByTagName('ideContri')->item(0); |
||
58 | //o idEvento pode variar de evento para evento |
||
59 | //então cada factory individualmente terá de construir o seu |
||
60 | $ideEvento = $this->dom->createElement("ideEvento"); |
||
61 | $this->dom->addChild( |
||
62 | $ideEvento, |
||
63 | "indRetif", |
||
64 | $this->std->indretif, |
||
65 | true |
||
66 | ); |
||
67 | $this->dom->addChild( |
||
68 | $ideEvento, |
||
69 | "nrRecibo", |
||
70 | !empty($this->std->nrrecibo) ? $this->std->nrrecibo : null, |
||
71 | true |
||
72 | ); |
||
73 | $this->dom->addChild( |
||
74 | $ideEvento, |
||
75 | "perApur", |
||
76 | $this->std->perapur, |
||
77 | true |
||
78 | ); |
||
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 | $this->node->insertBefore($ideEvento, $ideContri); |
||
98 | $ideBenef = $this->dom->createElement("ideBenef"); |
||
99 | $this->dom->addChild( |
||
100 | $ideBenef, |
||
101 | "codPgto", |
||
102 | $this->std->codpgto, |
||
103 | true |
||
104 | ); |
||
105 | $this->dom->addChild( |
||
106 | $ideBenef, |
||
107 | "tpInscBenef", |
||
108 | !empty($this->std->tpinscbenef) ? $this->std->tpinscbenef : null, |
||
109 | false |
||
110 | ); |
||
111 | $this->dom->addChild( |
||
112 | $ideBenef, |
||
113 | "nrInscBenef", |
||
114 | !empty($this->std->nrinscbenef) ? $this->std->nrinscbenef : null, |
||
115 | false |
||
116 | ); |
||
117 | $this->dom->addChild( |
||
118 | $ideBenef, |
||
119 | "nmRazaoBenef", |
||
120 | $this->std->nmrazaobenef, |
||
121 | true |
||
122 | ); |
||
123 | |||
124 | if (!empty($this->std->inforesidext)) { |
||
125 | $info = $this->std->inforesidext; |
||
126 | $infoResidExt = $this->dom->createElement("infoResidExt"); |
||
127 | $infoEnder = $this->dom->createElement("infoEnder"); |
||
128 | $this->dom->addChild( |
||
129 | $infoEnder, |
||
130 | "paisResid", |
||
131 | $info->paisresid, |
||
132 | true |
||
133 | ); |
||
134 | $this->dom->addChild( |
||
135 | $infoEnder, |
||
136 | "dscLograd", |
||
137 | $info->dsclograd, |
||
138 | true |
||
139 | ); |
||
140 | $this->dom->addChild( |
||
141 | $infoEnder, |
||
142 | "nrLograd", |
||
143 | !empty($info->nrlograd) ? $info->nrlograd : null, |
||
144 | false |
||
145 | ); |
||
146 | $this->dom->addChild( |
||
147 | $infoEnder, |
||
148 | "complem", |
||
149 | !empty($info->complem) ? $info->complem : null, |
||
150 | false |
||
151 | ); |
||
152 | $this->dom->addChild( |
||
153 | $infoEnder, |
||
154 | "bairro", |
||
155 | !empty($info->bairro) ? $info->bairro : null, |
||
156 | false |
||
157 | ); |
||
158 | $this->dom->addChild( |
||
159 | $infoEnder, |
||
160 | "cidade", |
||
161 | !empty($info->cidade) ? $info->cidade : null, |
||
162 | false |
||
163 | ); |
||
164 | $this->dom->addChild( |
||
165 | $infoEnder, |
||
166 | "codPostal", |
||
167 | !empty($info->codpostal) ? $info->codpostal : null, |
||
168 | false |
||
169 | ); |
||
170 | $infoResidExt->appendChild($infoEnder); |
||
171 | $infoFiscal = $this->dom->createElement("infoFiscal"); |
||
172 | $this->dom->addChild( |
||
173 | $infoFiscal, |
||
174 | "indNIF", |
||
175 | $info->indnif, |
||
176 | true |
||
177 | ); |
||
178 | $this->dom->addChild( |
||
179 | $infoFiscal, |
||
180 | "nifBenef", |
||
181 | !empty($info->nifbenef) ? $info->nifbenef : null, |
||
182 | false |
||
183 | ); |
||
184 | $this->dom->addChild( |
||
185 | $infoFiscal, |
||
186 | "relFontePagad", |
||
187 | !empty($info->relfontepagad) ? $info->relfontepagad : null, |
||
188 | false |
||
189 | ); |
||
190 | $infoResidExt->appendChild($infoFiscal); |
||
191 | $ideBenef->appendChild($infoResidExt); |
||
192 | } |
||
193 | if (!empty($this->std->infomolestia)) { |
||
194 | $mol = $this->std->infomolestia; |
||
195 | $infoMolestia = $this->dom->createElement("infoMolestia"); |
||
196 | $this->dom->addChild( |
||
197 | $infoMolestia, |
||
198 | "dtLaudo", |
||
199 | $mol->dtlaudo, |
||
200 | true |
||
201 | ); |
||
202 | $ideBenef->appendChild($infoMolestia); |
||
203 | } |
||
204 | |||
205 | $infoPgto = $this->dom->createElement("infoPgto"); |
||
206 | foreach ($this->std->ideestab as $stab) { |
||
207 | $ideEstab = $this->dom->createElement("ideEstab"); |
||
208 | $this->dom->addChild( |
||
209 | $ideEstab, |
||
210 | "tpInsc", |
||
211 | $stab->tpinsc, |
||
212 | true |
||
213 | ); |
||
214 | $this->dom->addChild( |
||
215 | $ideEstab, |
||
216 | "nrInsc", |
||
217 | $stab->nrinsc, |
||
218 | true |
||
219 | ); |
||
220 | $pgtoResidBR = null; |
||
221 | if (!empty($stab->pgtopf)) { |
||
222 | $pgtoResidBR = $this->dom->createElement("pgtoResidBR"); |
||
223 | foreach ($stab->pgtopf as $ppf) { |
||
224 | $pgtoPF = $this->dom->createElement("pgtoPF"); |
||
225 | $this->dom->addChild( |
||
226 | $pgtoPF, |
||
227 | "dtPgto", |
||
228 | $ppf->dtpgto, |
||
229 | true |
||
230 | ); |
||
231 | $this->dom->addChild( |
||
232 | $pgtoPF, |
||
233 | "indSuspExig", |
||
234 | $ppf->indsuspexig, |
||
235 | true |
||
236 | ); |
||
237 | $this->dom->addChild( |
||
238 | $pgtoPF, |
||
239 | "indDecTerceiro", |
||
240 | $ppf->inddecterceiro, |
||
241 | true |
||
242 | ); |
||
243 | $this->dom->addChild( |
||
244 | $pgtoPF, |
||
245 | "vlrRendTributavel", |
||
246 | number_format($ppf->vlrrendtributavel, 2, ',', ''), |
||
247 | true |
||
248 | ); |
||
249 | $this->dom->addChild( |
||
250 | $pgtoPF, |
||
251 | "vlrIRRF", |
||
252 | number_format($ppf->vlrirrf, 2, ',', ''), |
||
253 | true |
||
254 | ); |
||
255 | if (!empty($ppf->detdeducao)) { |
||
256 | foreach ($ppf->detdeducao as $dd) { |
||
257 | $detDeducao = $this->dom->createElement("detDeducao"); |
||
258 | $this->dom->addChild( |
||
259 | $detDeducao, |
||
260 | "indTpDeducao", |
||
261 | $dd->indtpdeducao, |
||
262 | true |
||
263 | ); |
||
264 | $this->dom->addChild( |
||
265 | $detDeducao, |
||
266 | "vlrDeducao", |
||
267 | number_format($dd->vlrdeducao, 2, ',', ''), |
||
268 | true |
||
269 | ); |
||
270 | $pgtoPF->appendChild($detDeducao); |
||
271 | } |
||
272 | } |
||
273 | if (!empty($ppf->rendisento)) { |
||
274 | foreach ($ppf->rendisento as $ri) { |
||
275 | $rendIsento = $this->dom->createElement("rendIsento"); |
||
276 | $this->dom->addChild( |
||
277 | $rendIsento, |
||
278 | "tpIsencao", |
||
279 | $ri->tpisencao, |
||
280 | true |
||
281 | ); |
||
282 | $this->dom->addChild( |
||
283 | $rendIsento, |
||
284 | "vlrIsento", |
||
285 | number_format($ri->vlrisento, 2, ',', ''), |
||
286 | true |
||
287 | ); |
||
288 | $this->dom->addChild( |
||
289 | $rendIsento, |
||
290 | "descRendimento", |
||
291 | !empty($ri->descrendimento) ? $ri->descrendimento : null, |
||
292 | false |
||
293 | ); |
||
294 | $pgtoPF->appendChild($rendIsento); |
||
295 | } |
||
296 | } |
||
297 | if (!empty($ppf->detcompet)) { |
||
298 | foreach ($ppf->detcompet as $dc) { |
||
299 | $detCompet = $this->dom->createElement("detCompet"); |
||
300 | $this->dom->addChild( |
||
301 | $detCompet, |
||
302 | "indPerReferencia", |
||
303 | $dc->indperreferencia, |
||
304 | true |
||
305 | ); |
||
306 | $this->dom->addChild( |
||
307 | $detCompet, |
||
308 | "perRefPagto", |
||
309 | $dc->perrefpagto, |
||
310 | true |
||
311 | ); |
||
312 | $this->dom->addChild( |
||
313 | $detCompet, |
||
314 | "vlrRendTributavel", |
||
315 | number_format($dc->vlrrendtributavel, 2, ',', ''), |
||
316 | true |
||
317 | ); |
||
318 | $pgtoPF->appendChild($detCompet); |
||
319 | } |
||
320 | } |
||
321 | if (!empty($ppf->compjud)) { |
||
322 | $cjud = $ppf->compjud; |
||
323 | $compJud = $this->dom->createElement("compJud"); |
||
324 | $this->dom->addChild( |
||
325 | $compJud, |
||
326 | "vlrCompAnoCalend", |
||
327 | !empty($cjud->vlrcompqnocalend) ? number_format($cjud->vlrcompqnocalend, 2, ',', '') : null, |
||
328 | false |
||
329 | ); |
||
330 | $this->dom->addChild( |
||
331 | $compJud, |
||
332 | "vlrCompAnoAnt", |
||
333 | !empty($cjud->vlrcompanoant) ? number_format($cjud->vlrcompanoant, 2, ',', '') : null, |
||
334 | false |
||
335 | ); |
||
336 | $pgtoPF->appendChild($compJud); |
||
337 | } |
||
338 | |||
339 | if (!empty($ppf->inforra)) { |
||
340 | foreach ($ppf->inforra as $irra) { |
||
341 | $infoRRA = $this->dom->createElement("infoRRA"); |
||
342 | $this->dom->addChild( |
||
343 | $infoRRA, |
||
344 | "tpProcRRA", |
||
345 | !empty($irra->tpprocrra) ? $irra->tpprocrra : null, |
||
346 | false |
||
347 | ); |
||
348 | $this->dom->addChild( |
||
349 | $infoRRA, |
||
350 | "nrProcRRA", |
||
351 | !empty($irra->nrprocrra) ? $irra->nrprocrra : null, |
||
352 | false |
||
353 | ); |
||
354 | $this->dom->addChild( |
||
355 | $infoRRA, |
||
356 | "codSusp", |
||
357 | !empty($irra->codsusp) ? $irra->codsusp : null, |
||
358 | false |
||
359 | ); |
||
360 | $this->dom->addChild( |
||
361 | $infoRRA, |
||
362 | "natRRA", |
||
363 | !empty($irra->natrra) ? $irra->natrra : null, |
||
364 | false |
||
365 | ); |
||
366 | $this->dom->addChild( |
||
367 | $infoRRA, |
||
368 | "qtdMesesRRA", |
||
369 | !empty($irra->qtdmesesrra) ? $irra->qtdmesesrra : null, |
||
370 | false |
||
371 | ); |
||
372 | if (!empty($irra->despprocjud)) { |
||
373 | $dpj = $irra->despprocjud; |
||
374 | $despProcJud = $this->dom->createElement("despProcJud"); |
||
375 | $this->dom->addChild( |
||
376 | $despProcJud, |
||
377 | "vlrDespCustas", |
||
378 | number_format($dpj->vlrdespcustas, 2, ',', ''), |
||
379 | true |
||
380 | ); |
||
381 | $this->dom->addChild( |
||
382 | $despProcJud, |
||
383 | "vlrDespAdvogados", |
||
384 | number_format($dpj->vlrdespadvogados, 2, ',', ''), |
||
385 | true |
||
386 | ); |
||
387 | if (!empty($dpj->ideadvogado)) { |
||
388 | foreach ($dpj->ideadvogado as $ia) { |
||
389 | $ideAdvogado = $this->dom->createElement("ideAdvogado"); |
||
390 | $this->dom->addChild( |
||
391 | $ideAdvogado, |
||
392 | "tpInscAdvogado", |
||
393 | $ia->tpinscadvogado, |
||
394 | true |
||
395 | ); |
||
396 | $this->dom->addChild( |
||
397 | $ideAdvogado, |
||
398 | "nrInscAdvogado", |
||
399 | $ia->nrinscadvogado, |
||
400 | true |
||
401 | ); |
||
402 | $this->dom->addChild( |
||
403 | $ideAdvogado, |
||
404 | "vlrAdvogado", |
||
405 | number_format($ia->vlradvogado, 2, ',', ''), |
||
406 | true |
||
407 | ); |
||
408 | $despProcJud->appendChild($ideAdvogado); |
||
409 | } |
||
410 | } |
||
411 | $infoRRA->appendChild($despProcJud); |
||
412 | } |
||
413 | $pgtoPF->appendChild($infoRRA); |
||
414 | } |
||
415 | } |
||
416 | if (!empty($ppf->infoprocjud)) { |
||
417 | foreach ($ppf->infoprocjud as $ipj) { |
||
418 | $infoProcJud = $this->dom->createElement("infoProcJud"); |
||
419 | $this->dom->addChild( |
||
420 | $infoProcJud, |
||
421 | "nrProcJud", |
||
422 | $ipj->nrprocjud, |
||
423 | true |
||
424 | ); |
||
425 | $this->dom->addChild( |
||
426 | $infoProcJud, |
||
427 | "codSusp", |
||
428 | !empty($ipj->codsusp) ? $ipj->codsusp : null, |
||
429 | false |
||
430 | ); |
||
431 | $this->dom->addChild( |
||
432 | $infoProcJud, |
||
433 | "indOrigemRecursos", |
||
434 | $ipj->indorigemrecursos, |
||
435 | true |
||
436 | ); |
||
437 | if (!empty($ipj->despprocjud)) { |
||
438 | $vdc = $ipj->despprocjud; |
||
439 | $despProcJud = $this->dom->createElement("despProcJud"); |
||
440 | $this->dom->addChild( |
||
441 | $despProcJud, |
||
442 | "vlrDespCustas", |
||
443 | number_format($vdc->vlrdespcustas, 2, ',', ''), |
||
444 | true |
||
445 | ); |
||
446 | $this->dom->addChild( |
||
447 | $despProcJud, |
||
448 | "vlrDespCustas", |
||
449 | number_format($vdc->vlrdespadvogados, 2, ',', ''), |
||
450 | true |
||
451 | ); |
||
452 | if (!empty($ipj->ideadvogado)) { |
||
453 | foreach ($ipj->ideadvogado as $ad) { |
||
454 | $ideAdvogado = $this->dom->createElement("ideAdvogado"); |
||
455 | $this->dom->addChild( |
||
456 | $ideAdvogado, |
||
457 | "tpInscAdvogado", |
||
458 | $ad->tpinscadvogado, |
||
459 | true |
||
460 | ); |
||
461 | $this->dom->addChild( |
||
462 | $ideAdvogado, |
||
463 | "nrInscAdvogado", |
||
464 | $ad->nrinscadvogado, |
||
465 | true |
||
466 | ); |
||
467 | $this->dom->addChild( |
||
468 | $ideAdvogado, |
||
469 | "vlrAdvogado", |
||
470 | number_format($ad->vlradvogado, 2, ',', ''), |
||
471 | true |
||
472 | ); |
||
473 | $despProcJud->appendChild($ideAdvogado); |
||
474 | } |
||
475 | } |
||
476 | $infoProcJud->appendChild($despProcJud); |
||
477 | } |
||
478 | if (!empty($ipj->origemrecursos)) { |
||
479 | $origemRecursos = $this->dom->createElement("origemRecursos"); |
||
480 | $this->dom->addChild( |
||
481 | $origemRecursos, |
||
482 | "cnpjOrigemRecursos", |
||
483 | $ipj->origemrecursos->cnpjorigemrecursos, |
||
484 | true |
||
485 | ); |
||
486 | $infoProcJud->appendChild($origemRecursos); |
||
487 | } |
||
488 | $pgtoPF->appendChild($infoProcJud); |
||
489 | } |
||
490 | } |
||
491 | if (!empty($ppf->depjudicial)) { |
||
492 | $dj = $ppf->depjudicial; |
||
493 | $depJudicial = $this->dom->createElement("depJudicial"); |
||
494 | $this->dom->addChild( |
||
495 | $depJudicial, |
||
496 | "vlrDepJudicial", |
||
497 | !empty($dj->vlrdepjudicial) ? number_format($dj->vlrdepjudicial, 2, ',', '') : null, |
||
498 | false |
||
499 | ); |
||
500 | $pgtoPF->appendChild($depJudicial); |
||
501 | } |
||
502 | $pgtoResidBR->appendChild($pgtoPF); |
||
503 | } |
||
504 | } |
||
505 | if (!empty($stab->pgtopj)) { |
||
506 | if (empty($pgtoResidBR)) { |
||
507 | $pgtoResidBR = $this->dom->createElement("pgtoResidBR"); |
||
508 | } |
||
509 | foreach ($stab->pgtopj as $ppj) { |
||
510 | $pgtoPJ = $this->dom->createElement("pgtoPJ"); |
||
511 | $this->dom->addChild( |
||
512 | $pgtoPJ, |
||
513 | "dtPagto", |
||
514 | $ppj->dtpagto, |
||
515 | true |
||
516 | ); |
||
517 | $this->dom->addChild( |
||
518 | $pgtoPJ, |
||
519 | "vlrRendTributavel", |
||
520 | number_format($ppj->vlrrendtributavel, 2, ',', ''), |
||
521 | true |
||
522 | ); |
||
523 | $this->dom->addChild( |
||
524 | $pgtoPJ, |
||
525 | "vlrRet", |
||
526 | number_format($ppj->vlrret, 2, ',', ''), |
||
527 | true |
||
528 | ); |
||
529 | if (!empty($ppj->infoprocjud)) { |
||
530 | foreach ($ppj->infoprocjud as $pj) { |
||
531 | $infoProcJud = $this->dom->createElement("infoProcJud"); |
||
532 | $this->dom->addChild( |
||
533 | $infoProcJud, |
||
534 | "nrProcJud", |
||
535 | $pj->nrprocjud, |
||
536 | true |
||
537 | ); |
||
538 | $this->dom->addChild( |
||
539 | $infoProcJud, |
||
540 | "codSusp", |
||
541 | !empty($pj->codsusp) ? $pj->codsusp : null, |
||
542 | false |
||
543 | ); |
||
544 | $this->dom->addChild( |
||
545 | $infoProcJud, |
||
546 | "indOrigemRecursos", |
||
547 | $pj->indorigemrecursos, |
||
548 | true |
||
549 | ); |
||
550 | if (!empty($pj->despprocjud)) { |
||
551 | $dpj = $pj->despprocjud; |
||
552 | $despProcJud = $this->dom->createElement("despProcJud"); |
||
553 | $this->dom->addChild( |
||
554 | $despProcJud, |
||
555 | "vlrDespCustas", |
||
556 | number_format($dpj->vlrdespcustas, 2, ',', ''), |
||
557 | true |
||
558 | ); |
||
559 | $this->dom->addChild( |
||
560 | $despProcJud, |
||
561 | "vlrDespAdvogados", |
||
562 | number_format($dpj->vlrdespadvogados, 2, ',', ''), |
||
563 | true |
||
564 | ); |
||
565 | if (!empty($dpj->ideadvogado)) { |
||
566 | foreach ($dpj->ideadvogado as $iad) { |
||
567 | $ideAdvogado = $this->dom->createElement("ideAdvogado"); |
||
568 | $this->dom->addChild( |
||
569 | $ideAdvogado, |
||
570 | "tpInscAdvogado", |
||
571 | $iad->tpinscadvogado, |
||
572 | true |
||
573 | ); |
||
574 | $this->dom->addChild( |
||
575 | $ideAdvogado, |
||
576 | "nrInscAdvogado", |
||
577 | $iad->nrinscadvogado, |
||
578 | true |
||
579 | ); |
||
580 | $this->dom->addChild( |
||
581 | $ideAdvogado, |
||
582 | "vlrAdvogado", |
||
583 | number_format($iad->vlradvogado, 2, ",", ""), |
||
584 | true |
||
585 | ); |
||
586 | $despProcJud->appendChild($ideAdvogado); |
||
587 | } |
||
588 | } |
||
589 | $infoProcJud->appendChild($despProcJud); |
||
590 | } |
||
591 | if (!empty($pj->origemrecursos)) { |
||
592 | $origemRecursos = $this->dom->createElement("origemRecursos"); |
||
593 | $this->dom->addChild( |
||
594 | $ideAdvogado, |
||
0 ignored issues
–
show
|
|||
595 | "cnpjOrigemRecursos", |
||
596 | $pj->origemrecursos->cnpjorigemrecursos, |
||
597 | true |
||
598 | ); |
||
599 | $infoProcJud->appendChild($origemRecursos); |
||
600 | } |
||
601 | $pgtoPJ->appendChild($infoProcJud); |
||
602 | } |
||
603 | } |
||
604 | $pgtoResidBR->appendChild($pgtoPJ); |
||
605 | } |
||
606 | } |
||
607 | if (!empty($pgtoResidBR)) { |
||
608 | $ideEstab->appendChild($pgtoResidBR); |
||
609 | $pgtoResidBR = null; |
||
0 ignored issues
–
show
$pgtoResidBR is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the
Loading history...
|
|||
610 | } |
||
611 | if (!empty($stab->pgtoresidext)) { |
||
612 | $ext = $stab->pgtoresidext; |
||
613 | $pgtoResidExt = $this->dom->createElement("pgtoResidExt"); |
||
614 | $this->dom->addChild( |
||
615 | $pgtoResidExt, |
||
616 | "dtPagto", |
||
617 | $ext->dtpagto, |
||
618 | true |
||
619 | ); |
||
620 | $this->dom->addChild( |
||
621 | $pgtoResidExt, |
||
622 | "tpRendimento", |
||
623 | $ext->tprendimento, |
||
624 | true |
||
625 | ); |
||
626 | $this->dom->addChild( |
||
627 | $pgtoResidExt, |
||
628 | "formaTributacao", |
||
629 | $ext->formatributacao, |
||
630 | true |
||
631 | ); |
||
632 | $this->dom->addChild( |
||
633 | $pgtoResidExt, |
||
634 | "vlrPgto", |
||
635 | number_format($ext->vlrpgto, 2, ',', ''), |
||
636 | true |
||
637 | ); |
||
638 | $this->dom->addChild( |
||
639 | $pgtoResidExt, |
||
640 | "vlrRet", |
||
641 | number_format($ext->vlrret, 2, ',', ''), |
||
642 | true |
||
643 | ); |
||
644 | $ideEstab->appendChild($pgtoResidExt); |
||
645 | } |
||
646 | $infoPgto->appendChild($ideEstab); |
||
647 | } |
||
648 | $ideBenef->appendChild($infoPgto); |
||
649 | $this->node->appendChild($ideBenef); |
||
650 | $this->reinf->appendChild($this->node); |
||
651 | //$this->xml = $this->dom->saveXML($this->reinf); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
59% of this comment could be valid code. Did you maybe forget this after debugging?
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.
Loading history...
|
|||
652 | $this->sign($this->evtTag); |
||
653 | } |
||
654 | } |
||
655 |
If you define a variable conditionally, it can happen that it is not defined for all execution paths.
Let’s take a look at an example:
In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.
Available Fixes
Check for existence of the variable explicitly:
Define a default value for the variable:
Add a value for the missing path: