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

@@ 751-772 (lines=22) @@
748
     *
749
     * @return string
750
     */
751
    public function xml(
752
        bool $multiDecodeNewHtmlEntity = false,
753
        bool $htmlToXml = true,
754
        bool $removeXmlHeader = true,
755
        int $options = \LIBXML_NOEMPTYTAG
756
    ): string {
757
        $xml = $this->document->saveXML(null, $options);
758
759
        if ($removeXmlHeader) {
760
            $xml = \ltrim((string) \preg_replace('/<\?xml.*\?>/', '', $xml));
761
        }
762
763
        if ($htmlToXml) {
764
            $return = $this->fixHtmlOutput($xml, $multiDecodeNewHtmlEntity);
765
        } else {
766
            $xml = $this->decodeHtmlEntity($xml, $multiDecodeNewHtmlEntity);
767
768
            $return = self::putReplacedBackToPreserveHtmlEntities($xml);
769
        }
770
771
        return $return;
772
    }
773
774
    /**
775
     * @param string $selector