Code Duplication    Length = 5-6 lines in 4 locations

system/Inji/Model.php 4 locations

@@ 359-363 (lines=5) @@
356
357
                $type = empty($relations[$rel]['type']) ? 'to' : $relations[$rel]['type'];
358
                switch ($type) {
359
                    case 'to':
360
                        $relCol = $relations[$rel]['col'];
361
                        static::fixPrefix($relCol);
362
                        $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
363
                        break;
364
                    case 'one':
365
                    case 'many':
366
                        $relCol = $relations[$rel]['col'];
@@ 365-369 (lines=5) @@
362
                        $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
363
                        break;
364
                    case 'one':
365
                    case 'many':
366
                        $relCol = $relations[$rel]['col'];
367
                        $relations[$rel]['model']::fixPrefix($relCol);
368
                        $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
369
                        break;
370
                }
371
                $relations[$rel]['model']::fixPrefix($col, 'key', $rootModel);
372
            }
@@ 405-410 (lines=6) @@
402
                $info['col'] = substr($info['col'], strpos($info['col'], ':') + 1);
403
                $type = empty($relations[$rel]['type']) ? 'to' : $relations[$rel]['type'];
404
                switch ($type) {
405
                    case 'to':
406
                        $relCol = $relations[$rel]['col'];
407
                        static::fixPrefix($relCol);
408
                        //$info['modelName'] = $relations[$rel]['model'];
409
                        $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
410
                        break;
411
                    case 'one':
412
                        $relCol = $relations[$rel]['col'];
413
                        $relations[$rel]['model']::fixPrefix($relCol);
@@ 411-416 (lines=6) @@
408
                        //$info['modelName'] = $relations[$rel]['model'];
409
                        $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
410
                        break;
411
                    case 'one':
412
                        $relCol = $relations[$rel]['col'];
413
                        $relations[$rel]['model']::fixPrefix($relCol);
414
                        //$info['modelName'] = $relations[$rel]['model'];
415
                        $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
416
                        break;
417
                }
418
                $info = $relations[$rel]['model']::parseColRecursion($info);
419
            }