Code Duplication    Length = 3-7 lines in 2 locations

code/Model/SiteTree.php 2 locations

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