Code Duplication    Length = 27-29 lines in 2 locations

manager/includes/src/Core.php 2 locations

@@ 1653-1679 (lines=27) @@
1650
                $str = trim($str, '()"\'');
1651
                $docid = $this->getIdFromAlias($str);
1652
                break;
1653
            case 'prev':
1654
                if (!$option) {
1655
                    $option = 'menuindex,ASC';
1656
                } elseif (strpos($option, ',') === false) {
1657
                    $option .= ',ASC';
1658
                }
1659
                list($by, $dir) = explode(',', $option, 2);
1660
                $children = $this->getActiveChildren($parent, $by, $dir);
1661
                $find = false;
1662
                $prev = false;
1663
                foreach ($children as $row) {
1664
                    if ($row['id'] == $this->documentIdentifier) {
1665
                        $find = true;
1666
                        break;
1667
                    }
1668
                    $prev = $row;
1669
                }
1670
                if ($find) {
1671
                    if (isset($prev[$key])) {
1672
                        return $prev[$key];
1673
                    } else {
1674
                        $docid = $prev['id'];
1675
                    }
1676
                } else {
1677
                    $docid = '';
1678
                }
1679
                break;
1680
            case 'next':
1681
                if (!$option) {
1682
                    $option = 'menuindex,ASC';
@@ 1680-1708 (lines=29) @@
1677
                    $docid = '';
1678
                }
1679
                break;
1680
            case 'next':
1681
                if (!$option) {
1682
                    $option = 'menuindex,ASC';
1683
                } elseif (strpos($option, ',') === false) {
1684
                    $option .= ',ASC';
1685
                }
1686
                list($by, $dir) = explode(',', $option, 2);
1687
                $children = $this->getActiveChildren($parent, $by, $dir);
1688
                $find = false;
1689
                $next = false;
1690
                foreach ($children as $row) {
1691
                    if ($find) {
1692
                        $next = $row;
1693
                        break;
1694
                    }
1695
                    if ($row['id'] == $this->documentIdentifier) {
1696
                        $find = true;
1697
                    }
1698
                }
1699
                if ($find) {
1700
                    if (isset($next[$key])) {
1701
                        return $next[$key];
1702
                    } else {
1703
                        $docid = $next['id'];
1704
                    }
1705
                } else {
1706
                    $docid = '';
1707
                }
1708
                break;
1709
            default:
1710
                $docid = $str;
1711
        }