Code Duplication    Length = 5-5 lines in 4 locations

system/Inji/Model.php 4 locations

@@ 550-554 (lines=5) @@
547
                $type = empty($relations[$rel]['type']) ? 'to' : $relations[$rel]['type'];
548
                $joinName = $relations[$rel]['model'] . '_' . $rel;
549
                switch ($type) {
550
                    case 'to':
551
                        $relCol = $relations[$rel]['col'];
552
                        static::fixPrefix($relCol);
553
                        $rootModel::$relJoins[$joinName] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol, 'left', ''];
554
                        break;
555
                    case 'one':
556
                    case 'many':
557
                        $relCol = $relations[$rel]['col'];
@@ 556-560 (lines=5) @@
553
                        $rootModel::$relJoins[$joinName] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol, 'left', ''];
554
                        break;
555
                    case 'one':
556
                    case 'many':
557
                        $relCol = $relations[$rel]['col'];
558
                        $relations[$rel]['model']::fixPrefix($relCol);
559
                        $rootModel::$relJoins[$joinName] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol, 'left', ''];
560
                        break;
561
                    case 'relModel':
562
                        $relation = $relations[$rel];
563
                        $fixedCol = $relation['model']::index();
@@ 612-616 (lines=5) @@
609
                $type = empty($relations[$rel]['type']) ? 'to' : $relations[$rel]['type'];
610
                $joinName = $relations[$rel]['model'] . '_' . $rel;
611
                switch ($type) {
612
                    case 'to':
613
                        $relCol = $relations[$rel]['col'];
614
                        static::fixPrefix($relCol);
615
                        $info['joins'][$joinName] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
616
                        break;
617
                    case 'one':
618
                        $relCol = $relations[$rel]['col'];
619
                        $relations[$rel]['model']::fixPrefix($relCol);
@@ 617-621 (lines=5) @@
614
                        static::fixPrefix($relCol);
615
                        $info['joins'][$joinName] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
616
                        break;
617
                    case 'one':
618
                        $relCol = $relations[$rel]['col'];
619
                        $relations[$rel]['model']::fixPrefix($relCol);
620
                        $info['joins'][$joinName] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
621
                        break;
622
                }
623
                $info = $relations[$rel]['model']::parseColRecursion($info);
624
            }