Code Duplication    Length = 5-6 lines in 4 locations

typo3/sysext/core/Classes/Html/HtmlParser.php 4 locations

@@ 378-382 (lines=5) @@
375
        $skipTag = false;
376
        foreach ($tokArrSliced as $tok) {
377
            if ($inComment) {
378
                if (($eocPos = strpos($tok, '-->')) === false) {
379
                    // End of comment is not found in the token. Go further until end of comment is found in other tokens.
380
                    $newContent[$c++] = '<' . $tok;
381
                    continue;
382
                }
383
                // Comment ends in the middle of the token: add comment and proceed with rest of the token
384
                $newContent[$c++] = '<' . substr($tok, 0, ($eocPos + 3));
385
                $tok = substr($tok, $eocPos + 3);
@@ 389-393 (lines=5) @@
386
                $inComment = false;
387
                $skipTag = true;
388
            } elseif ($inCdata) {
389
                if (($eocPos = strpos($tok, '/*]]>*/')) === false) {
390
                    // End of comment is not found in the token. Go further until end of comment is found in other tokens.
391
                    $newContent[$c++] = '<' . $tok;
392
                    continue;
393
                }
394
                // Comment ends in the middle of the token: add comment and proceed with rest of the token
395
                $newContent[$c++] = '<' . substr($tok, 0, $eocPos + 10);
396
                $tok = substr($tok, $eocPos + 10);
@@ 400-405 (lines=6) @@
397
                $inCdata = false;
398
                $skipTag = true;
399
            } elseif (substr($tok, 0, 3) === '!--') {
400
                if (($eocPos = strpos($tok, '-->')) === false) {
401
                    // Comment started in this token but it does end in the same token. Set a flag to skip till the end of comment
402
                    $newContent[$c++] = '<' . $tok;
403
                    $inComment = true;
404
                    continue;
405
                }
406
                // Start and end of comment are both in the current token. Add comment and proceed with rest of the token
407
                $newContent[$c++] = '<' . substr($tok, 0, ($eocPos + 3));
408
                $tok = substr($tok, $eocPos + 3);
@@ 411-416 (lines=6) @@
408
                $tok = substr($tok, $eocPos + 3);
409
                $skipTag = true;
410
            } elseif (substr($tok, 0, 10) === '![CDATA[*/') {
411
                if (($eocPos = strpos($tok, '/*]]>*/')) === false) {
412
                    // Comment started in this token but it does end in the same token. Set a flag to skip till the end of comment
413
                    $newContent[$c++] = '<' . $tok;
414
                    $inCdata = true;
415
                    continue;
416
                }
417
                // Start and end of comment are both in the current token. Add comment and proceed with rest of the token
418
                $newContent[$c++] = '<' . substr($tok, 0, $eocPos + 10);
419
                $tok = substr($tok, $eocPos + 10);