Code Duplication    Length = 3-7 lines in 2 locations

code/Model/SiteTree.php 2 locations

@@ 351-357 (lines=7) @@
348
		if(!$sitetree) {
349
			$parentID = self::config()->nested_urls ? 0 : null;
350
351
			if($alternatives = static::singleton()->extend('alternateGetByLink', $URLSegment, $parentID)) {
352
				foreach($alternatives as $alternative) {
353
					if($alternative) {
354
						$sitetree = $alternative;
355
					}
356
				}
357
			}
358
359
			if(!$sitetree) {
360
				return null;
@@ 381-383 (lines=3) @@
378
			if(!$next) {
379
				$parentID = (int) $sitetree->ID;
380
381
				if($alternatives = static::singleton()->extend('alternateGetByLink', $segment, $parentID)) {
382
					foreach($alternatives as $alternative) if($alternative) $next = $alternative;
383
				}
384
385
				if(!$next) {
386
					return null;