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

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