Code Duplication    Length = 5-5 lines in 4 locations

system/Inji/Model.php 4 locations

@@ 515-519 (lines=5) @@
512
                $type = empty($relations[$rel]['type']) ? 'to' : $relations[$rel]['type'];
513
                $joinName = $relations[$rel]['model'] . '_' . $rel;
514
                switch ($type) {
515
                    case 'to':
516
                        $relCol = $relations[$rel]['col'];
517
                        static::fixPrefix($relCol);
518
                        $rootModel::$relJoins[$joinName] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol, 'left', ''];
519
                        break;
520
                    case 'one':
521
                    case 'many':
522
                        $relCol = $relations[$rel]['col'];
@@ 521-525 (lines=5) @@
518
                        $rootModel::$relJoins[$joinName] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol, 'left', ''];
519
                        break;
520
                    case 'one':
521
                    case 'many':
522
                        $relCol = $relations[$rel]['col'];
523
                        $relations[$rel]['model']::fixPrefix($relCol);
524
                        $rootModel::$relJoins[$joinName] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol, 'left', ''];
525
                        break;
526
                }
527
                $relations[$rel]['model']::fixPrefix($col, 'key', $rootModel);
528
            }
@@ 566-570 (lines=5) @@
563
                $type = empty($relations[$rel]['type']) ? 'to' : $relations[$rel]['type'];
564
                $joinName = $relations[$rel]['model'] . '_' . $rel;
565
                switch ($type) {
566
                    case 'to':
567
                        $relCol = $relations[$rel]['col'];
568
                        static::fixPrefix($relCol);
569
                        $info['joins'][$joinName] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
570
                        break;
571
                    case 'one':
572
                        $relCol = $relations[$rel]['col'];
573
                        $relations[$rel]['model']::fixPrefix($relCol);
@@ 571-575 (lines=5) @@
568
                        static::fixPrefix($relCol);
569
                        $info['joins'][$joinName] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
570
                        break;
571
                    case 'one':
572
                        $relCol = $relations[$rel]['col'];
573
                        $relations[$rel]['model']::fixPrefix($relCol);
574
                        $info['joins'][$joinName] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
575
                        break;
576
                }
577
                $info = $relations[$rel]['model']::parseColRecursion($info);
578
            }