Code Duplication    Length = 13-13 lines in 2 locations

includes/parser/Preprocessor_DOM.php 1 location

@@ 628-640 (lines=13) @@
625
				# check for maximum matching characters (if there are 5 closing
626
				# characters, we will probably need only 3 - depending on the rules)
627
				$rule = $this->rules[$piece->open];
628
				if ( $count > $rule['max'] ) {
629
					# The specified maximum exists in the callback array, unless the caller
630
					# has made an error
631
					$matchingCount = $rule['max'];
632
				} else {
633
					# Count is less than the maximum
634
					# Skip any gaps in the callback array to find the true largest match
635
					# Need to use array_key_exists not isset because the callback can be null
636
					$matchingCount = $count;
637
					while ( $matchingCount > 0 && !array_key_exists( $matchingCount, $rule['names'] ) ) {
638
						--$matchingCount;
639
					}
640
				}
641
642
				if ( $matchingCount <= 0 ) {
643
					# No matching element found in callback array

includes/parser/Preprocessor_Hash.php 1 location

@@ 570-582 (lines=13) @@
567
				# check for maximum matching characters (if there are 5 closing
568
				# characters, we will probably need only 3 - depending on the rules)
569
				$rule = $this->rules[$piece->open];
570
				if ( $count > $rule['max'] ) {
571
					# The specified maximum exists in the callback array, unless the caller
572
					# has made an error
573
					$matchingCount = $rule['max'];
574
				} else {
575
					# Count is less than the maximum
576
					# Skip any gaps in the callback array to find the true largest match
577
					# Need to use array_key_exists not isset because the callback can be null
578
					$matchingCount = $count;
579
					while ( $matchingCount > 0 && !array_key_exists( $matchingCount, $rule['names'] ) ) {
580
						--$matchingCount;
581
					}
582
				}
583
584
				if ( $matchingCount <= 0 ) {
585
					# No matching element found in callback array