Code Duplication    Length = 3-7 lines in 2 locations

code/Model/SiteTree.php 2 locations

@@ 382-388 (lines=7) @@
379
        if (!$sitetree) {
380
            $parentID = self::config()->nested_urls ? 0 : null;
381
382
            if ($alternatives = static::singleton()->extend('alternateGetByLink', $URLSegment, $parentID)) {
383
                foreach ($alternatives as $alternative) {
384
                    if ($alternative) {
385
                        $sitetree = $alternative;
386
                    }
387
                }
388
            }
389
390
            if (!$sitetree) {
391
                return null;
@@ 414-416 (lines=3) @@
411
            if (!$next) {
412
                $parentID = (int) $sitetree->ID;
413
414
                if ($alternatives = static::singleton()->extend('alternateGetByLink', $segment, $parentID)) {
415
                    foreach ($alternatives as $alternative) {
416
                        if ($alternative) {
417
                            $next = $alternative;
418
                        }
419
                    }