Code Duplication    Length = 27-29 lines in 2 locations

manager/includes/src/Core.php 2 locations

@@ 1672-1698 (lines=27) @@
1669
                $str = trim($str, '()"\'');
1670
                $docid = $this->getIdFromAlias($str);
1671
                break;
1672
            case 'prev':
1673
                if (!$option) {
1674
                    $option = 'menuindex,ASC';
1675
                } elseif (strpos($option, ',') === false) {
1676
                    $option .= ',ASC';
1677
                }
1678
                list($by, $dir) = explode(',', $option, 2);
1679
                $children = $this->getActiveChildren($parent, $by, $dir);
1680
                $find = false;
1681
                $prev = false;
1682
                foreach ($children as $row) {
1683
                    if ($row['id'] == $this->documentIdentifier) {
1684
                        $find = true;
1685
                        break;
1686
                    }
1687
                    $prev = $row;
1688
                }
1689
                if ($find) {
1690
                    if (isset($prev[$key])) {
1691
                        return $prev[$key];
1692
                    } else {
1693
                        $docid = $prev['id'];
1694
                    }
1695
                } else {
1696
                    $docid = '';
1697
                }
1698
                break;
1699
            case 'next':
1700
                if (!$option) {
1701
                    $option = 'menuindex,ASC';
@@ 1699-1727 (lines=29) @@
1696
                    $docid = '';
1697
                }
1698
                break;
1699
            case 'next':
1700
                if (!$option) {
1701
                    $option = 'menuindex,ASC';
1702
                } elseif (strpos($option, ',') === false) {
1703
                    $option .= ',ASC';
1704
                }
1705
                list($by, $dir) = explode(',', $option, 2);
1706
                $children = $this->getActiveChildren($parent, $by, $dir);
1707
                $find = false;
1708
                $next = false;
1709
                foreach ($children as $row) {
1710
                    if ($find) {
1711
                        $next = $row;
1712
                        break;
1713
                    }
1714
                    if ($row['id'] == $this->documentIdentifier) {
1715
                        $find = true;
1716
                    }
1717
                }
1718
                if ($find) {
1719
                    if (isset($next[$key])) {
1720
                        return $next[$key];
1721
                    } else {
1722
                        $docid = $next['id'];
1723
                    }
1724
                } else {
1725
                    $docid = '';
1726
                }
1727
                break;
1728
            default:
1729
                $docid = $str;
1730
        }