Code Duplication    Length = 27-29 lines in 2 locations

manager/includes/src/Core.php 2 locations

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