Code Duplication    Length = 5-5 lines in 3 locations

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

@@ 206-210 (lines=5) @@
203
        /**
204
         * @var ExtendedCacheItemInterface $item
205
         */
206
        if (!array_key_exists($item->getKey(), $this->itemInstances)) {
207
            $this->itemInstances[ $item->getKey() ] = $item;
208
        } else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
209
            throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.');
210
        }
211
212
        if ($this->driverWrite($item) && $this->driverWriteTags($item)) {
213
            $item->setHit(true);
@@ 230-234 (lines=5) @@
227
     */
228
    public function saveDeferred(CacheItemInterface $item)
229
    {
230
        if (!array_key_exists($item->getKey(), $this->itemInstances)) {
231
            $this->itemInstances[ $item->getKey() ] = $item;
232
        }else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
233
            throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.');
234
        }
235
236
        return $this->deferredList[ $item->getKey() ] = $item;
237
    }

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

@@ 327-331 (lines=5) @@
324
     */
325
    public function attachItem(CacheItemInterface $item)
326
    {
327
        if(isset($this->itemInstances[$item->getKey()]) && spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
328
            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.');
329
        }else{
330
            $this->itemInstances[$item->getKey()] = $item;
331
        }
332
    }
333
334