Code Duplication    Length = 5-6 lines in 4 locations

system/Inji/Model.php 4 locations

@@ 553-557 (lines=5) @@
550
551
                $type = empty($relations[$rel]['type']) ? 'to' : $relations[$rel]['type'];
552
                switch ($type) {
553
                    case 'to':
554
                        $relCol = $relations[$rel]['col'];
555
                        static::fixPrefix($relCol);
556
                        $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
557
                        break;
558
                    case 'one':
559
                    case 'many':
560
                        $relCol = $relations[$rel]['col'];
@@ 559-563 (lines=5) @@
556
                        $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
557
                        break;
558
                    case 'one':
559
                    case 'many':
560
                        $relCol = $relations[$rel]['col'];
561
                        $relations[$rel]['model']::fixPrefix($relCol);
562
                        $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
563
                        break;
564
                }
565
                $relations[$rel]['model']::fixPrefix($col, 'key', $rootModel);
566
            }
@@ 597-602 (lines=6) @@
594
                $info['col'] = substr($info['col'], strpos($info['col'], ':') + 1);
595
                $type = empty($relations[$rel]['type']) ? 'to' : $relations[$rel]['type'];
596
                switch ($type) {
597
                    case 'to':
598
                        $relCol = $relations[$rel]['col'];
599
                        static::fixPrefix($relCol);
600
                        $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
601
                        break;
602
                    case 'one':
603
                        $relCol = $relations[$rel]['col'];
604
                        $relations[$rel]['model']::fixPrefix($relCol);
605
                        $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
@@ 602-607 (lines=6) @@
599
                        static::fixPrefix($relCol);
600
                        $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
601
                        break;
602
                    case 'one':
603
                        $relCol = $relations[$rel]['col'];
604
                        $relations[$rel]['model']::fixPrefix($relCol);
605
                        $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
606
                        break;
607
                }
608
                $info = $relations[$rel]['model']::parseColRecursion($info);
609
            }
610
        } else {