Code Duplication    Length = 3-7 lines in 2 locations

code/Model/SiteTree.php 2 locations

@@ 378-384 (lines=7) @@
375
        if (!$sitetree) {
376
            $parentID = self::config()->nested_urls ? 0 : null;
377
378
            if ($alternatives = static::singleton()->extend('alternateGetByLink', $URLSegment, $parentID)) {
379
                foreach ($alternatives as $alternative) {
380
                    if ($alternative) {
381
                        $sitetree = $alternative;
382
                    }
383
                }
384
            }
385
386
            if (!$sitetree) {
387
                return null;
@@ 410-412 (lines=3) @@
407
            if (!$next) {
408
                $parentID = (int) $sitetree->ID;
409
410
                if ($alternatives = static::singleton()->extend('alternateGetByLink', $segment, $parentID)) {
411
                    foreach ($alternatives as $alternative) {
412
                        if ($alternative) {
413
                            $next = $alternative;
414
                        }
415
                    }