Code Duplication    Length = 13-13 lines in 2 locations

src/phpFastCache/Drivers/Predis/Driver.php 1 location

@@ 68-80 (lines=13) @@
65
     * @return mixed
66
     * @throws phpFastCacheInvalidArgumentException
67
     */
68
    protected function driverWrite(CacheItemInterface $item)
69
    {
70
        /**
71
         * Check for Cross-Driver type confusion
72
         */
73
        if ($item instanceof Item) {
74
            $ttl = $item->getExpirationDate()->getTimestamp() - time();
75
76
            return $this->instance->setex($item->getKey(), $ttl, $this->encode($this->driverPreWrap($item)));
77
        } else {
78
            throw new phpFastCacheInvalidArgumentException('Cross-Driver type confusion detected');
79
        }
80
    }
81
82
    /**
83
     * @param \Psr\Cache\CacheItemInterface $item

src/phpFastCache/Drivers/Redis/Driver.php 1 location

@@ 65-77 (lines=13) @@
62
     * @return mixed
63
     * @throws phpFastCacheInvalidArgumentException
64
     */
65
    protected function driverWrite(CacheItemInterface $item)
66
    {
67
        /**
68
         * Check for Cross-Driver type confusion
69
         */
70
        if ($item instanceof Item) {
71
            $ttl = $item->getExpirationDate()->getTimestamp() - time();
72
73
            return $this->instance->setex($item->getKey(), $ttl, $this->encode($this->driverPreWrap($item)));
74
        } else {
75
            throw new phpFastCacheInvalidArgumentException('Cross-Driver type confusion detected');
76
        }
77
    }
78
79
    /**
80
     * @param \Psr\Cache\CacheItemInterface $item