Code Duplication    Length = 5-6 lines in 4 locations

system/Inji/Model.php 4 locations

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