Code Duplication    Length = 13-20 lines in 3 locations

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

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

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

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

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

@@ 72-91 (lines=20) @@
69
     * @return mixed
70
     * @throws \InvalidArgumentException
71
     */
72
    protected function driverWrite(CacheItemInterface $item)
73
    {
74
        /**
75
         * Check for Cross-Driver type confusion
76
         */
77
        if ($item instanceof Item) {
78
            /*            if (isset($this->config[ 'skipExisting' ]) && $this->config[ 'skipExisting' ] == true) {
79
                            $x = $this->instance->get($item->getKey());
80
                            if ($x === false) {
81
                                return false;
82
                            } elseif (!is_null($x)) {
83
                                return true;
84
                            }
85
                        }*/
86
87
            return $this->instance->setx($item->getKey(), $this->encode($this->driverPreWrap($item)), $item->getTtl());
88
        } else {
89
            throw new \InvalidArgumentException('Cross-Driver type confusion detected');
90
        }
91
    }
92
93
    /**
94
     * @param \Psr\Cache\CacheItemInterface $item