Code Duplication    Length = 8-13 lines in 3 locations

src/EntityCollection.php 1 location

@@ 145-157 (lines=13) @@
142
     * @throws MappingException
143
     * @return string
144
     */
145
    public function getEntityHashes()
146
    {
147
        return array_map(function ($entity) {
148
            $class = get_class($entity);
149
150
            $mapper = Manager::getMapper($class);
151
            
152
            $keyName = $mapper->getEntityMap()->getKeyName();
153
            
154
            return $class . '.' . $entity->getEntityAttribute($keyName);
155
        },
156
        $this->items);
157
    }
158
159
    /**
160
     * Get a subset of the collection from entity hashes

src/Relationships/Relationship.php 1 location

@@ 413-420 (lines=8) @@
410
     * @param  Mappable $entity
411
     * @return string
412
     */
413
    protected function getEntityHash(Mappable $entity)
414
    {
415
        $class = get_class($entity);
416
417
        $keyName = Mapper::getMapper($class)->getEntityMap()->getKeyName();
418
419
        return $class . '.' . $entity->getEntityAttribute($keyName);
420
    }
421
422
    /**
423
     * Run synchronization content if needed by the

src/System/EntityCache.php 1 location

@@ 226-235 (lines=10) @@
223
     * @throws MappingException
224
     * @return string
225
     */
226
    protected function getEntityHash(InternallyMappable $entity)
227
    {
228
        $class = get_class($entity->getObject());
229
230
        $mapper = Manager::getMapper($class);
231
232
        $keyName = $mapper->getEntityMap()->getKeyName();
233
234
        return $class . '.' . $entity->getEntityAttribute($keyName);
235
    }
236
237
    /**
238
     * Refresh the cache record for an aggregated entity after a write operation