Code Duplication    Length = 27-29 lines in 2 locations

manager/includes/src/Core.php 2 locations

@@ 1401-1427 (lines=27) @@
1398
                $str = trim($str, '()"\'');
1399
                $docid = $this->getIdFromAlias($str);
1400
                break;
1401
            case 'prev':
1402
                if (!$option) {
1403
                    $option = 'menuindex,ASC';
1404
                } elseif (strpos($option, ',') === false) {
1405
                    $option .= ',ASC';
1406
                }
1407
                list($by, $dir) = explode(',', $option, 2);
1408
                $children = $this->getActiveChildren($parent, $by, $dir);
1409
                $find = false;
1410
                $prev = false;
1411
                foreach ($children as $row) {
1412
                    if ($row['id'] == $this->documentIdentifier) {
1413
                        $find = true;
1414
                        break;
1415
                    }
1416
                    $prev = $row;
1417
                }
1418
                if ($find) {
1419
                    if (isset($prev[$key])) {
1420
                        return $prev[$key];
1421
                    } else {
1422
                        $docid = $prev['id'];
1423
                    }
1424
                } else {
1425
                    $docid = '';
1426
                }
1427
                break;
1428
            case 'next':
1429
                if (!$option) {
1430
                    $option = 'menuindex,ASC';
@@ 1428-1456 (lines=29) @@
1425
                    $docid = '';
1426
                }
1427
                break;
1428
            case 'next':
1429
                if (!$option) {
1430
                    $option = 'menuindex,ASC';
1431
                } elseif (strpos($option, ',') === false) {
1432
                    $option .= ',ASC';
1433
                }
1434
                list($by, $dir) = explode(',', $option, 2);
1435
                $children = $this->getActiveChildren($parent, $by, $dir);
1436
                $find = false;
1437
                $next = false;
1438
                foreach ($children as $row) {
1439
                    if ($find) {
1440
                        $next = $row;
1441
                        break;
1442
                    }
1443
                    if ($row['id'] == $this->documentIdentifier) {
1444
                        $find = true;
1445
                    }
1446
                }
1447
                if ($find) {
1448
                    if (isset($next[$key])) {
1449
                        return $next[$key];
1450
                    } else {
1451
                        $docid = $next['id'];
1452
                    }
1453
                } else {
1454
                    $docid = '';
1455
                }
1456
                break;
1457
            default:
1458
                $docid = $str;
1459
        }