Code Duplication    Length = 7-7 lines in 4 locations

lib/Sii/Factoring/Cesion.php 1 location

@@ 207-213 (lines=7) @@
204
    {
205
        $xml_unsigned = (new \sasco\LibreDTE\XML())->generate($this->datos)->saveXML();
206
        $xml = $Firma->signXML($xml_unsigned, '#'.$this->getID(), 'DocumentoCesion');
207
        if (!$xml) {
208
            \sasco\LibreDTE\Log::write(
209
                \sasco\LibreDTE\Estado::DTE_ERROR_FIRMA,
210
                \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::DTE_ERROR_FIRMA, '#'.$this->getID())
211
            );
212
            return false;
213
        }
214
        $this->xml = new \sasco\LibreDTE\XML();
215
        if (!$this->xml->loadXML($xml) or !$this->schemaValidate())
216
            return false;

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

@@ 480-486 (lines=7) @@
477
        }
478
        $TED->getElementsByTagName('FRMT')->item(0)->nodeValue = base64_encode($timbre);
479
        $xml = str_replace('<TED/>', trim(str_replace('<?xml version="1.0" encoding="ISO-8859-1"?>', '', $TED->saveXML())), $this->saveXML());
480
        if (!$this->loadXML($xml)) {
481
            \sasco\LibreDTE\Log::write(
482
                \sasco\LibreDTE\Estado::DTE_ERROR_TIMBRE,
483
                \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::DTE_ERROR_TIMBRE, $this->getID())
484
            );
485
            return false;
486
        }
487
        return true;
488
    }
489
@@ 502-508 (lines=7) @@
499
        $parent = $this->xml->getElementsByTagName($this->tipo_general)->item(0);
500
        $this->xml->generate(['TmstFirma'=>$this->timestamp], null, $parent);
501
        $xml = $Firma->signXML($this->xml->saveXML(), '#'.$this->id, $this->tipo_general);
502
        if (!$xml) {
503
            \sasco\LibreDTE\Log::write(
504
                \sasco\LibreDTE\Estado::DTE_ERROR_FIRMA,
505
                \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::DTE_ERROR_FIRMA, $this->getID())
506
            );
507
            return false;
508
        }
509
        $this->loadXML($xml);
510
        return true;
511
    }