Code Duplication    Length = 22-22 lines in 2 locations

src/voku/helper/AbstractDomParser.php 1 location

@@ 333-354 (lines=22) @@
330
     *
331
     * @return string
332
     */
333
    public function xml(
334
        bool $multiDecodeNewHtmlEntity = false,
335
        bool $htmlToXml = true,
336
        bool $removeXmlHeader = true,
337
        int $options = \LIBXML_NOEMPTYTAG
338
    ): string {
339
        $xml = $this->document->saveXML(null, $options);
340
341
        if ($removeXmlHeader) {
342
            $xml = \ltrim((string) \preg_replace('/<\?xml.*\?>/', '', $xml));
343
        }
344
345
        if ($htmlToXml) {
346
            $return = $this->fixHtmlOutput($xml, $multiDecodeNewHtmlEntity);
347
        } else {
348
            $xml = $this->decodeHtmlEntity($xml, $multiDecodeNewHtmlEntity);
349
350
            $return = self::putReplacedBackToPreserveHtmlEntities($xml);
351
        }
352
353
        return $return;
354
    }
355
356
    /**
357
     * Get the encoding to use.

src/voku/helper/HtmlDomParser.php 1 location

@@ 793-814 (lines=22) @@
790
     *
791
     * @return string
792
     */
793
    public function xml(
794
        bool $multiDecodeNewHtmlEntity = false,
795
        bool $htmlToXml = true,
796
        bool $removeXmlHeader = true,
797
        int $options = \LIBXML_NOEMPTYTAG
798
    ): string {
799
        $xml = $this->document->saveXML(null, $options);
800
801
        if ($removeXmlHeader) {
802
            $xml = \ltrim((string) \preg_replace('/<\?xml.*\?>/', '', $xml));
803
        }
804
805
        if ($htmlToXml) {
806
            $return = $this->fixHtmlOutput($xml, $multiDecodeNewHtmlEntity);
807
        } else {
808
            $xml = $this->decodeHtmlEntity($xml, $multiDecodeNewHtmlEntity);
809
810
            $return = self::putReplacedBackToPreserveHtmlEntities($xml);
811
        }
812
813
        return $return;
814
    }
815
816
    /**
817
     * @param string $selector