Code Duplication    Length = 3-7 lines in 2 locations

code/Model/SiteTree.php 2 locations

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