Code Duplication    Length = 5-5 lines in 2 locations

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

@@ 416-420 (lines=5) @@
413
        if (!empty($modelName::$cols[$colName]['relation'])) {
414
            $type = !empty($relations[$modelName::$cols[$colName]['relation']]['type']) ? $relations[$modelName::$cols[$colName]['relation']]['type'] : 'to';
415
            switch ($type) {
416
                case 'relModel':
417
                    $managerParams = ['relation' => $modelName::$cols[$colName]['relation']];
418
                    $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1]));
419
                    $count = $count ? $count : 'Нет';
420
                    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}</a>";
421
                case 'many':
422
                    $managerParams = ['relation' => $modelName::$cols[$colName]['relation']];
423
                    $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1]));
@@ 421-425 (lines=5) @@
418
                    $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1]));
419
                    $count = $count ? $count : 'Нет';
420
                    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}</a>";
421
                case 'many':
422
                    $managerParams = ['relation' => $modelName::$cols[$colName]['relation']];
423
                    $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1]));
424
                    $count = $count ? $count : 'Нет';
425
                    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}</a>";
426
                default :
427
                    if ($item->{$modelName::$cols[$colName]['relation']}) {
428
                        if (\App::$cur->name == 'admin') {