Code Duplication    Length = 3-7 lines in 2 locations

code/Model/SiteTree.php 2 locations

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