Code Duplication    Length = 5-5 lines in 3 locations

src/phpFastCache/Core/Pool/CacheItemPoolTrait.php 2 locations

@@ 232-236 (lines=5) @@
229
        /**
230
         * @var ExtendedCacheItemInterface $item
231
         */
232
        if (!array_key_exists($item->getKey(), $this->itemInstances)) {
233
            $this->itemInstances[ $item->getKey() ] = $item;
234
        } else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
235
            throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.');
236
        }
237
238
        /**
239
         * @eventName CacheSaveItem
@@ 263-267 (lines=5) @@
260
     */
261
    public function saveDeferred(CacheItemInterface $item)
262
    {
263
        if (!array_key_exists($item->getKey(), $this->itemInstances)) {
264
            $this->itemInstances[ $item->getKey() ] = $item;
265
        }else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
266
            throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.');
267
        }
268
269
        /**
270
         * @eventName CacheSaveDeferredItem

src/phpFastCache/Core/Pool/ExtendedCacheItemPoolTrait.php 1 location

@@ 328-332 (lines=5) @@
325
     */
326
    public function attachItem(CacheItemInterface $item)
327
    {
328
        if(isset($this->itemInstances[$item->getKey()]) && spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
329
            throw new \LogicException('The item already exists and cannot be overwritten because the Spl object hash mismatches ! You probably tried to re-attach a detached item which has been already retrieved from cache.');
330
        }else{
331
            $this->itemInstances[$item->getKey()] = $item;
332
        }
333
    }
334
335