Code Duplication    Length = 22-22 lines in 2 locations

src/voku/helper/AbstractDomParser.php 1 location

@@ 352-373 (lines=22) @@
349
     *
350
     * @return string
351
     */
352
    public function xml(
353
        bool $multiDecodeNewHtmlEntity = false,
354
        bool $htmlToXml = true,
355
        bool $removeXmlHeader = true,
356
        int $options = \LIBXML_NOEMPTYTAG
357
    ): string {
358
        $xml = $this->document->saveXML(null, $options);
359
360
        if ($removeXmlHeader) {
361
            $xml = \ltrim((string) \preg_replace('/<\?xml.*\?>/', '', $xml));
362
        }
363
364
        if ($htmlToXml) {
365
            $return = $this->fixHtmlOutput($xml, $multiDecodeNewHtmlEntity);
366
        } else {
367
            $xml = $this->decodeHtmlEntity($xml, $multiDecodeNewHtmlEntity);
368
369
            $return = self::putReplacedBackToPreserveHtmlEntities($xml);
370
        }
371
372
        return $return;
373
    }
374
375
    /**
376
     * Get the encoding to use.

src/voku/helper/HtmlDomParser.php 1 location

@@ 768-789 (lines=22) @@
765
     *
766
     * @return string
767
     */
768
    public function xml(
769
        bool $multiDecodeNewHtmlEntity = false,
770
        bool $htmlToXml = true,
771
        bool $removeXmlHeader = true,
772
        int $options = \LIBXML_NOEMPTYTAG
773
    ): string {
774
        $xml = $this->document->saveXML(null, $options);
775
776
        if ($removeXmlHeader) {
777
            $xml = \ltrim((string) \preg_replace('/<\?xml.*\?>/', '', $xml));
778
        }
779
780
        if ($htmlToXml) {
781
            $return = $this->fixHtmlOutput($xml, $multiDecodeNewHtmlEntity);
782
        } else {
783
            $xml = $this->decodeHtmlEntity($xml, $multiDecodeNewHtmlEntity);
784
785
            $return = self::putReplacedBackToPreserveHtmlEntities($xml);
786
        }
787
788
        return $return;
789
    }
790
791
    /**
792
     * @param string $selector