Code Duplication    Length = 5-6 lines in 4 locations

system/Inji/Model.php 4 locations

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