Code Duplication    Length = 4-4 lines in 3 locations

system/modules/Ui/objects/DataManager.php 3 locations

@@ 406-409 (lines=4) @@
403
        if (!empty($modelName::$cols[$colName]['relation'])) {
404
            $type = !empty($relations[$modelName::$cols[$colName]['relation']]['type']) ? $relations[$modelName::$cols[$colName]['relation']]['type'] : 'to';
405
            switch ($type) {
406
                case 'relModel':
407
                    $managerParams = ['relation' => $modelName::$cols[$colName]['relation']];
408
                    $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1]));
409
                    return "<a class = 'btn btn-xs btn-primary' onclick = 'inji.Ui.dataManagers.popUp(\"" . str_replace('\\', '\\\\', $modelName) . ":" . $item->pk() . "\"," . json_encode(array_merge($params, $managerParams)) . ")'>{$count} " . \Tools::getNumEnding($count, ['Элемент', 'Элемента', 'Элементов']) . "</a>";
410
                case 'many':
411
                    $managerParams = ['relation' => $modelName::$cols[$colName]['relation']];
412
                    $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1]));
@@ 410-413 (lines=4) @@
407
                    $managerParams = ['relation' => $modelName::$cols[$colName]['relation']];
408
                    $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1]));
409
                    return "<a class = 'btn btn-xs btn-primary' onclick = 'inji.Ui.dataManagers.popUp(\"" . str_replace('\\', '\\\\', $modelName) . ":" . $item->pk() . "\"," . json_encode(array_merge($params, $managerParams)) . ")'>{$count} " . \Tools::getNumEnding($count, ['Элемент', 'Элемента', 'Элементов']) . "</a>";
410
                case 'many':
411
                    $managerParams = ['relation' => $modelName::$cols[$colName]['relation']];
412
                    $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1]));
413
                    return "<a class = 'btn btn-xs btn-primary' onclick = 'inji.Ui.dataManagers.popUp(\"" . str_replace('\\', '\\\\', $modelName) . ":" . $item->pk() . "\"," . json_encode(array_merge($params, $managerParams)) . ")'>{$count} " . \Tools::getNumEnding($count, ['Элемент', 'Элемента', 'Элементов']) . "</a>";
414
                default :
415
                    if ($item->{$modelName::$cols[$colName]['relation']}) {
416
                        if (\App::$cur->name == 'admin') {
@@ 444-447 (lines=4) @@
441
                        return $content;
442
                    case 'moduleMethod':
443
                        return \App::$cur->{$modelName::$cols[$colName]['view']['module']}->{$modelName::$cols[$colName]['view']['method']}($item, $colName, $modelName::$cols[$colName]);
444
                    case'many':
445
                        $managerParams = ['relation' => $modelName::$cols[$colName]['relation']];
446
                        $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1]));
447
                        return "<a class = 'btn btn-xs btn-primary' onclick = 'inji.Ui.dataManagers.popUp(\"" . str_replace('\\', '\\\\', $modelName) . ":" . $item->pk() . "\"," . json_encode(array_merge($params, $managerParams)) . ")'>{$count} " . \Tools::getNumEnding($count, ['Элемент', 'Элемента', 'Элементов']) . "</a>";
448
                    default:
449
                        return $item->$colName;
450
                }