Code Duplication    Length = 5-5 lines in 2 locations

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

@@ 437-441 (lines=5) @@
434
    if (!empty($modelName::$cols[$colName]['relation'])) {
435
      $type = !empty($relations[$modelName::$cols[$colName]['relation']]['type']) ? $relations[$modelName::$cols[$colName]['relation']]['type'] : 'to';
436
      switch ($type) {
437
        case 'relModel':
438
          $managerParams = ['relation' => $modelName::$cols[$colName]['relation']];
439
          $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1]));
440
          $count = $count ? $count : 'Нет';
441
          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>";
442
        case 'many':
443
          $managerParams = ['relation' => $modelName::$cols[$colName]['relation']];
444
          $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1]));
@@ 442-446 (lines=5) @@
439
          $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1]));
440
          $count = $count ? $count : 'Нет';
441
          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>";
442
        case 'many':
443
          $managerParams = ['relation' => $modelName::$cols[$colName]['relation']];
444
          $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1]));
445
          $count = $count ? $count : 'Нет';
446
          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>";
447
        default :
448
          if ($item->{$modelName::$cols[$colName]['relation']}) {
449
            if (\App::$cur->name == 'admin') {