Code Duplication    Length = 16-17 lines in 2 locations

includes/parser/Preprocessor_DOM.php 1 location

@@ 471-486 (lines=16) @@
468
						$inner = substr( $text, $tagEndPos + 1, $matches[0][1] - $tagEndPos - 1 );
469
						$i = $matches[0][1] + strlen( $matches[0][0] );
470
						$close = '<close>' . htmlspecialchars( $matches[0][0] ) . '</close>';
471
					} else {
472
						// No end tag
473
						if ( in_array( $name, $xmlishAllowMissingEndTag ) ) {
474
							// Let it run out to the end of the text.
475
							$inner = substr( $text, $tagEndPos + 1 );
476
							$i = $lengthText;
477
							$close = '';
478
						} else {
479
							// Don't match the tag, treat opening tag as literal and resume parsing.
480
							$i = $tagEndPos + 1;
481
							$accum .= htmlspecialchars( substr( $text, $tagStartPos, $tagEndPos + 1 - $tagStartPos ) );
482
							// Cache results, otherwise we have O(N^2) performance for input like <foo><foo><foo>...
483
							$noMoreClosingTag[$name] = true;
484
							continue;
485
						}
486
					}
487
				}
488
				// <includeonly> and <noinclude> just become <ignore> tags
489
				if ( in_array( $lowerName, $ignoredElements ) ) {

includes/parser/Preprocessor_Hash.php 1 location

@@ 405-421 (lines=17) @@
402
						$inner = substr( $text, $tagEndPos + 1, $matches[0][1] - $tagEndPos - 1 );
403
						$i = $matches[0][1] + strlen( $matches[0][0] );
404
						$close = $matches[0][0];
405
					} else {
406
						// No end tag
407
						if ( in_array( $name, $xmlishAllowMissingEndTag ) ) {
408
							// Let it run out to the end of the text.
409
							$inner = substr( $text, $tagEndPos + 1 );
410
							$i = $lengthText;
411
							$close = null;
412
						} else {
413
							// Don't match the tag, treat opening tag as literal and resume parsing.
414
							$i = $tagEndPos + 1;
415
							self::addLiteral( $accum,
416
								substr( $text, $tagStartPos, $tagEndPos + 1 - $tagStartPos ) );
417
							// Cache results, otherwise we have O(N^2) performance for input like <foo><foo><foo>...
418
							$noMoreClosingTag[$name] = true;
419
							continue;
420
						}
421
					}
422
				}
423
				// <includeonly> and <noinclude> just become <ignore> tags
424
				if ( in_array( $lowerName, $ignoredElements ) ) {