Code Duplication    Length = 5-6 lines in 4 locations

system/Inji/Model.php 4 locations

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