Code Duplication    Length = 6-6 lines in 2 locations

src/Repository.php 2 locations

@@ 157-162 (lines=6) @@
154
        if (!empty($data->getData())) {
155
            foreach ($data->getData() as $tuple) {
156
                $data = $this->type->fromTuple($tuple);
157
                if (isset($data['id']) && array_key_exists($data['id'], $this->keyMap)) {
158
                    $entity = $this->entities[$this->keyMap[$data['id']]];
159
                    $entity->update($data);
160
                } else {
161
                    $entity = $this->createInstance($data);
162
                }
163
                if ($oneItem) {
164
                    return $this->findCache[$findKey] = $entity;
165
                }
@@ 316-321 (lines=6) @@
313
        $tuples = $this->type->getManager()->getClient()->evaluate($query)->getData()[0];
314
        foreach ($tuples as $tuple) {
315
            $data = $this->type->fromTuple($tuple);
316
            if (isset($data['id']) && array_key_exists($data['id'], $this->keyMap)) {
317
                $entity = $this->entities[$this->keyMap[$data['id']]];
318
                $entity->update($data);
319
            } else {
320
                $entity = $this->createInstance($data);
321
            }
322
            $result[] = $entity;
323
        }
324