Code Duplication    Length = 5-6 lines in 4 locations

system/Inji/Model.php 4 locations

@@ 509-513 (lines=5) @@
506
507
                $type = empty($relations[$rel]['type']) ? 'to' : $relations[$rel]['type'];
508
                switch ($type) {
509
                    case 'to':
510
                        $relCol = $relations[$rel]['col'];
511
                        static::fixPrefix($relCol);
512
                        $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
513
                        break;
514
                    case 'one':
515
                    case 'many':
516
                        $relCol = $relations[$rel]['col'];
@@ 515-519 (lines=5) @@
512
                        $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
513
                        break;
514
                    case 'one':
515
                    case 'many':
516
                        $relCol = $relations[$rel]['col'];
517
                        $relations[$rel]['model']::fixPrefix($relCol);
518
                        $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
519
                        break;
520
                }
521
                $relations[$rel]['model']::fixPrefix($col, 'key', $rootModel);
522
            }
@@ 553-558 (lines=6) @@
550
                $info['col'] = substr($info['col'], strpos($info['col'], ':') + 1);
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
                        $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
557
                        break;
558
                    case 'one':
559
                        $relCol = $relations[$rel]['col'];
560
                        $relations[$rel]['model']::fixPrefix($relCol);
561
                        $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
@@ 558-563 (lines=6) @@
555
                        static::fixPrefix($relCol);
556
                        $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
557
                        break;
558
                    case 'one':
559
                        $relCol = $relations[$rel]['col'];
560
                        $relations[$rel]['model']::fixPrefix($relCol);
561
                        $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
562
                        break;
563
                }
564
                $info = $relations[$rel]['model']::parseColRecursion($info);
565
            }
566
        } else {