Code Duplication    Length = 4-6 lines in 2 locations

src/Repository.php 2 locations

@@ 41-46 (lines=6) @@
38
            foreach ($data as $k => $v) {
39
                if (!is_numeric($k)) {
40
                    $newData[$k] = $v;
41
                } else {
42
                    if ($v instanceof Contracts\Entity) {
43
                        $type = $this->type->getManager()->findRepository($v)->getType();
44
                        $newData[$this->type->getReferenceProperty($type)] = $v->getId();
45
                    }
46
                }
47
            }
48
            $data = $newData;
49
        }
@@ 103-106 (lines=4) @@
100
101
        if (is_array($params)) {
102
            foreach ($params as $key => $value) {
103
                if (is_numeric($key) && $value instanceof Contracts\Entity) {
104
                    $type = $this->type->getManager()->findRepository($value)->getType();
105
                    $key = $this->type->getReferenceProperty($type);
106
                }
107
                if ($this->type->hasProperty($key)) {
108
                    $query[$key] = $this->type->encodeProperty($key, $value);
109
                }