Code Duplication    Length = 3-7 lines in 2 locations

code/Model/SiteTree.php 2 locations

@@ 359-365 (lines=7) @@
356
		if(!$sitetree) {
357
			$parentID = self::config()->nested_urls ? 0 : null;
358
359
			if($alternatives = static::singleton()->extend('alternateGetByLink', $URLSegment, $parentID)) {
360
				foreach($alternatives as $alternative) {
361
					if($alternative) {
362
						$sitetree = $alternative;
363
			}
364
				}
365
			}
366
367
			if(!$sitetree) {
368
				return null;
@@ 389-391 (lines=3) @@
386
			if(!$next) {
387
				$parentID = (int) $sitetree->ID;
388
389
				if($alternatives = static::singleton()->extend('alternateGetByLink', $segment, $parentID)) {
390
					foreach($alternatives as $alternative) if($alternative) $next = $alternative;
391
				}
392
393
				if(!$next) {
394
					return null;