Code Duplication    Length = 14-14 lines in 2 locations

system/modules/Migrations/objects/Parser/Object/Value.php 1 location

@@ 31-44 (lines=14) @@
28
                    case 'selfMethod':
29
                        $type = $this->model->{$col['selfMethod']}();
30
                        if (is_array($type)) {
31
                            if (strpos($type['relation'], ':')) {
32
                                $relationPath = explode(':', $type['relation']);
33
                                $relationName = array_pop($relationPath);
34
                                $item = $this->model;
35
                                foreach ($relationPath as $path) {
36
                                    $item = $item->$path;
37
                                }
38
                                $itemModel = get_class($item);
39
                                $relation = $itemModel::getRelation($relationName);
40
                                $sourceModel = $relation['model'];
41
                            } else {
42
                                $relation = $modelName::getRelation($type['relation']);
43
                                $sourceModel = $relation['model'];
44
                            }
45
                            $objectId = \App::$cur->migrations->findObject((string) $value, $sourceModel);
46
                            if ($objectId) {
47
                                $value = $objectId->object_id;

system/Inji/Model.php 1 location

@@ 294-307 (lines=14) @@
291
                    case 'selfMethod':
292
                        $type = $item->{$colInfo['colParams']['selfMethod']}();
293
                        if (is_array($type)) {
294
                            if (strpos($type['relation'], ':')) {
295
                                $relationPath = explode(':', $type['relation']);
296
                                $relationName = array_pop($relationPath);
297
                                $curItem = $item;
298
                                foreach ($relationPath as $path) {
299
                                    $curItem = $curItem->$path;
300
                                }
301
                                $itemModel = get_class($curItem);
302
                                $relation = $itemModel::getRelation($relationName);
303
                                $sourceModel = $relation['model'];
304
                            } else {
305
                                $relation = static::getRelation($type['relation']);
306
                                $sourceModel = $relation['model'];
307
                            }
308
                            $value = $sourceModel::get($item->$colName);
309
                            if ($value) {
310
                                $value = $value->name();