Code Duplication    Length = 5-6 lines in 4 locations

system/Inji/Model.php 4 locations

@@ 512-516 (lines=5) @@
509
510
        $type = empty($relations[$rel]['type']) ? 'to' : $relations[$rel]['type'];
511
        switch ($type) {
512
          case 'to':
513
            $relCol = $relations[$rel]['col'];
514
            static::fixPrefix($relCol);
515
            $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
516
            break;
517
          case 'one':
518
          case 'many':
519
            $relCol = $relations[$rel]['col'];
@@ 518-522 (lines=5) @@
515
            $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
516
            break;
517
          case 'one':
518
          case 'many':
519
            $relCol = $relations[$rel]['col'];
520
            $relations[$rel]['model']::fixPrefix($relCol);
521
            $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
522
            break;
523
        }
524
        $relations[$rel]['model']::fixPrefix($col, 'key', $rootModel);
525
      }
@@ 556-561 (lines=6) @@
553
        $info['col'] = substr($info['col'], strpos($info['col'], ':') + 1);
554
        $type = empty($relations[$rel]['type']) ? 'to' : $relations[$rel]['type'];
555
        switch ($type) {
556
          case 'to':
557
            $relCol = $relations[$rel]['col'];
558
            static::fixPrefix($relCol);
559
            //$info['modelName'] = $relations[$rel]['model'];
560
            $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
561
            break;
562
          case 'one':
563
            $relCol = $relations[$rel]['col'];
564
            $relations[$rel]['model']::fixPrefix($relCol);
@@ 562-567 (lines=6) @@
559
            //$info['modelName'] = $relations[$rel]['model'];
560
            $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
561
            break;
562
          case 'one':
563
            $relCol = $relations[$rel]['col'];
564
            $relations[$rel]['model']::fixPrefix($relCol);
565
            //$info['modelName'] = $relations[$rel]['model'];
566
            $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
567
            break;
568
        }
569
        $info = $relations[$rel]['model']::parseColRecursion($info);
570
      }