Code Duplication    Length = 27-29 lines in 2 locations

core/src/Core.php 2 locations

@@ 1225-1251 (lines=27) @@
1222
                $str = trim($str, '()"\'');
1223
                $docid = UrlProcessor::getIdFromAlias($str);
1224
                break;
1225
            case 'prev':
1226
                if (!$option) {
1227
                    $option = 'menuindex,ASC';
1228
                } elseif (strpos($option, ',') === false) {
1229
                    $option .= ',ASC';
1230
                }
1231
                list($by, $dir) = explode(',', $option, 2);
1232
                $children = $this->getActiveChildren($parent, $by, $dir);
1233
                $find = false;
1234
                $prev = false;
1235
                foreach ($children as $row) {
1236
                    if ($row['id'] == $this->documentIdentifier) {
1237
                        $find = true;
1238
                        break;
1239
                    }
1240
                    $prev = $row;
1241
                }
1242
                if ($find) {
1243
                    if (isset($prev[$key])) {
1244
                        return $prev[$key];
1245
                    } else {
1246
                        $docid = $prev['id'];
1247
                    }
1248
                } else {
1249
                    $docid = '';
1250
                }
1251
                break;
1252
            case 'next':
1253
                if (!$option) {
1254
                    $option = 'menuindex,ASC';
@@ 1252-1280 (lines=29) @@
1249
                    $docid = '';
1250
                }
1251
                break;
1252
            case 'next':
1253
                if (!$option) {
1254
                    $option = 'menuindex,ASC';
1255
                } elseif (strpos($option, ',') === false) {
1256
                    $option .= ',ASC';
1257
                }
1258
                list($by, $dir) = explode(',', $option, 2);
1259
                $children = $this->getActiveChildren($parent, $by, $dir);
1260
                $find = false;
1261
                $next = false;
1262
                foreach ($children as $row) {
1263
                    if ($find) {
1264
                        $next = $row;
1265
                        break;
1266
                    }
1267
                    if ($row['id'] == $this->documentIdentifier) {
1268
                        $find = true;
1269
                    }
1270
                }
1271
                if ($find) {
1272
                    if (isset($next[$key])) {
1273
                        return $next[$key];
1274
                    } else {
1275
                        $docid = $next['id'];
1276
                    }
1277
                } else {
1278
                    $docid = '';
1279
                }
1280
                break;
1281
            default:
1282
                $docid = $str;
1283
        }