Code Duplication    Length = 5-6 lines in 4 locations

system/Inji/Model.php 4 locations

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