Code Duplication    Length = 5-6 lines in 4 locations

system/Inji/Model.php 4 locations

@@ 521-525 (lines=5) @@
518
519
                $type = empty($relations[$rel]['type']) ? 'to' : $relations[$rel]['type'];
520
                switch ($type) {
521
                    case 'to':
522
                        $relCol = $relations[$rel]['col'];
523
                        static::fixPrefix($relCol);
524
                        $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
525
                        break;
526
                    case 'one':
527
                    case 'many':
528
                        $relCol = $relations[$rel]['col'];
@@ 527-531 (lines=5) @@
524
                        $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
525
                        break;
526
                    case 'one':
527
                    case 'many':
528
                        $relCol = $relations[$rel]['col'];
529
                        $relations[$rel]['model']::fixPrefix($relCol);
530
                        $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
531
                        break;
532
                }
533
                $relations[$rel]['model']::fixPrefix($col, 'key', $rootModel);
534
            }
@@ 565-570 (lines=6) @@
562
                $info['col'] = substr($info['col'], strpos($info['col'], ':') + 1);
563
                $type = empty($relations[$rel]['type']) ? 'to' : $relations[$rel]['type'];
564
                switch ($type) {
565
                    case 'to':
566
                        $relCol = $relations[$rel]['col'];
567
                        static::fixPrefix($relCol);
568
                        $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
569
                        break;
570
                    case 'one':
571
                        $relCol = $relations[$rel]['col'];
572
                        $relations[$rel]['model']::fixPrefix($relCol);
573
                        $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
@@ 570-575 (lines=6) @@
567
                        static::fixPrefix($relCol);
568
                        $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
569
                        break;
570
                    case 'one':
571
                        $relCol = $relations[$rel]['col'];
572
                        $relations[$rel]['model']::fixPrefix($relCol);
573
                        $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
574
                        break;
575
                }
576
                $info = $relations[$rel]['model']::parseColRecursion($info);
577
            }
578
        } else {