Code Duplication    Length = 7-7 lines in 3 locations

lib/Sii/Dte.php 2 locations

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

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
    /**