Code Duplication    Length = 6-8 lines in 3 locations

includes/parser/BlockLevelPass.php 3 locations

@@ 399-404 (lines=6) @@
396
		}
397
398
		$ltPos = strpos( $str, '<' );
399
		if ( $ltPos === false || $ltPos > $colonPos ) {
400
			# Easy; no tag nesting to worry about
401
			$before = substr( $str, 0, $colonPos );
402
			$after = substr( $str, $colonPos + 1 );
403
			return $colonPos;
404
		}
405
406
		# Ugly state machine to walk through avoiding tags.
407
		$state = self::COLON_STATE_TEXT;
@@ 421-426 (lines=6) @@
418
					$state = self::COLON_STATE_TAGSTART;
419
					break;
420
				case ":":
421
					if ( $level === 0 ) {
422
						# We found it!
423
						$before = substr( $str, 0, $i );
424
						$after = substr( $str, $i + 1 );
425
						return $i;
426
					}
427
					# Embedded in a tag; don't break it.
428
					break;
429
				default:
@@ 437-444 (lines=8) @@
434
						return false;
435
					}
436
					$ltPos = strpos( $str, '<', $i );
437
					if ( $level === 0 ) {
438
						if ( $ltPos === false || $colonPos < $ltPos ) {
439
							# We found it!
440
							$before = substr( $str, 0, $colonPos );
441
							$after = substr( $str, $colonPos + 1 );
442
							return $i;
443
						}
444
					}
445
					if ( $ltPos === false ) {
446
						# Nothing else interesting to find; abort!
447
						# We're nested, but there's no close tags left. Abort!