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

@@ 713-734 (lines=22) @@
710
     *
711
     * @return string
712
     */
713
    public function xml(
714
        bool $multiDecodeNewHtmlEntity = false,
715
        bool $htmlToXml = true,
716
        bool $removeXmlHeader = true,
717
        int $options = \LIBXML_NOEMPTYTAG
718
    ): string {
719
        $xml = $this->document->saveXML(null, $options);
720
721
        if ($removeXmlHeader) {
722
            $xml = \ltrim((string) \preg_replace('/<\?xml.*\?>/', '', $xml));
723
        }
724
725
        if ($htmlToXml) {
726
            $return = $this->fixHtmlOutput($xml, $multiDecodeNewHtmlEntity);
727
        } else {
728
            $xml = $this->decodeHtmlEntity($xml, $multiDecodeNewHtmlEntity);
729
730
            $return = self::putReplacedBackToPreserveHtmlEntities($xml);
731
        }
732
733
        return $return;
734
    }
735
736
    /**
737
     * @param string $selector