Code Duplication    Length = 13-20 lines in 3 locations

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

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

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

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

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

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