Code Duplication    Length = 6-7 lines in 2 locations

system/modules/Migrations/objects/Parser/Object.php 2 locations

@@ 193-199 (lines=7) @@
190
                        $relationName = $this->parentParam->param->value;
191
                        if (!empty($this->parentModel->$relationName(['key' => $where[0][0]])[$where[0][1]])) {
192
                            return $this->parentModel->$relationName(['key' => $where[0][0]])[$where[0][1]];
193
                        } else {
194
                            $model = new $this->object->model;
195
                            foreach ($where as $item) {
196
                                $model->{$item[0]} = $item[1];
197
                            }
198
                            return $model;
199
                        }
200
                    } elseif (!empty($relation['type']) && $relation['type'] == 'many') {
201
                        $where[] = [$relation['col'], $this->parentModel->pk()];
202
                    }
@@ 211-216 (lines=6) @@
208
            if ($where) {
209
                $modelName = $this->object->model;
210
                $model = $modelName::get($where);
211
                if (!$model) {
212
                    $model = new $this->object->model;
213
                    foreach ($where as $item) {
214
                        $model->{$item[0]} = $item[1];
215
                    }
216
                }
217
            }
218
        }
219
        return $model;