Code Duplication    Length = 5-6 lines in 4 locations

system/Inji/Model.php 4 locations

@@ 402-406 (lines=5) @@
399
400
        $type = empty($relations[$rel]['type']) ? 'to' : $relations[$rel]['type'];
401
        switch ($type) {
402
          case 'to':
403
            $relCol = $relations[$rel]['col'];
404
            static::fixPrefix($relCol);
405
            $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
406
            break;
407
          case 'one':
408
          case 'many':
409
            $relCol = $relations[$rel]['col'];
@@ 408-412 (lines=5) @@
405
            $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
406
            break;
407
          case 'one':
408
          case 'many':
409
            $relCol = $relations[$rel]['col'];
410
            $relations[$rel]['model']::fixPrefix($relCol);
411
            $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
412
            break;
413
        }
414
        $relations[$rel]['model']::fixPrefix($col, 'key', $rootModel);
415
      }
@@ 446-451 (lines=6) @@
443
        $info['col'] = substr($info['col'], strpos($info['col'], ':') + 1);
444
        $type = empty($relations[$rel]['type']) ? 'to' : $relations[$rel]['type'];
445
        switch ($type) {
446
          case 'to':
447
            $relCol = $relations[$rel]['col'];
448
            static::fixPrefix($relCol);
449
            //$info['modelName'] = $relations[$rel]['model'];
450
            $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
451
            break;
452
          case 'one':
453
            $relCol = $relations[$rel]['col'];
454
            $relations[$rel]['model']::fixPrefix($relCol);
@@ 452-457 (lines=6) @@
449
            //$info['modelName'] = $relations[$rel]['model'];
450
            $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
451
            break;
452
          case 'one':
453
            $relCol = $relations[$rel]['col'];
454
            $relations[$rel]['model']::fixPrefix($relCol);
455
            //$info['modelName'] = $relations[$rel]['model'];
456
            $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
457
            break;
458
        }
459
        $info = $relations[$rel]['model']::parseColRecursion($info);
460
      }