Code Duplication    Length = 7-7 lines in 3 locations

lib/Sii/Folios.php 1 location

@@ 46-52 (lines=7) @@
43
    {
44
        $this->xml = new \sasco\LibreDTE\XML();
45
        $this->xml->loadXML(utf8_encode($xml));
46
        if (!$this->check()) {
47
            \sasco\LibreDTE\Log::write(
48
                \sasco\LibreDTE\Estado::FOLIOS_ERROR_CHECK,
49
                \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::FOLIOS_ERROR_CHECK)
50
            );
51
            $this->xml = null;
52
        }
53
    }
54
55
    /**

lib/Sii/Dte.php 2 locations

@@ 456-462 (lines=7) @@
453
        }
454
        $TED->getElementsByTagName('FRMT')->item(0)->nodeValue = base64_encode($timbre);
455
        $xml = str_replace('<TED/>', trim(str_replace('<?xml version="1.0" encoding="ISO-8859-1"?>', '', $TED->saveXML())), $this->saveXML());
456
        if (!$this->loadXML($xml)) {
457
            \sasco\LibreDTE\Log::write(
458
                \sasco\LibreDTE\Estado::DTE_ERROR_TIMBRE,
459
                \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::DTE_ERROR_TIMBRE, $this->getID())
460
            );
461
            return false;
462
        }
463
        return true;
464
    }
465
@@ 478-484 (lines=7) @@
475
        $parent = $this->xml->getElementsByTagName($this->tipo_general)->item(0);
476
        $this->xml->generate(['TmstFirma'=>$this->timestamp], $parent);
477
        $xml = $Firma->signXML($this->xml->saveXML(), '#'.$this->id, $this->tipo_general);
478
        if (!$xml) {
479
            \sasco\LibreDTE\Log::write(
480
                \sasco\LibreDTE\Estado::DTE_ERROR_FIRMA,
481
                \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::DTE_ERROR_FIRMA, $this->getID())
482
            );
483
            return false;
484
        }
485
        $this->loadXML($xml);
486
        return true;
487
    }