Code Duplication    Length = 10-10 lines in 2 locations

src/voku/helper/HtmlDomParser.php 2 locations

@@ 281-290 (lines=10) @@
278
    {
279
        // Remove content before <!DOCTYPE.*> because otherwise the DOMDocument can not handle the input.
280
        $isDOMDocumentCreatedWithDoctype = false;
281
        if (\stripos($html, '<!DOCTYPE') !== false) {
282
            $isDOMDocumentCreatedWithDoctype = true;
283
            if (
284
                \preg_match('/(^.*?)<!(?:DOCTYPE)(?: [^>]*)?>/sui', $html, $matches_before_doctype)
285
                &&
286
                \trim($matches_before_doctype[1])
287
            ) {
288
                $html = \str_replace($matches_before_doctype[1], '', $html);
289
            }
290
        }
291
292
        if ($this->keepBrokenHtml) {
293
            $html = $this->keepBrokenHtml(\trim($html));
@@ 348-357 (lines=10) @@
345
            $this->isDOMDocumentCreatedWithFakeEndScript = true;
346
        }
347
348
        if (\stripos($html, '</html>') !== false) {
349
            /** @noinspection NestedPositiveIfStatementsInspection */
350
            if (
351
                \preg_match('/<\/html>(.*?)/suiU', $html, $matches_after_html)
352
                &&
353
                \trim($matches_after_html[1])
354
            ) {
355
                $html = \str_replace($matches_after_html[0], $matches_after_html[1] . '</html>', $html);
356
            }
357
        }
358
359
        if (\strpos($html, '<script') !== false) {
360
            $this->html5FallbackForScriptTags($html);