Code Duplication    Length = 27-29 lines in 2 locations

manager/includes/src/Core.php 2 locations

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