Code Duplication    Length = 18-18 lines in 2 locations

src/SimpleCacheAdapter.php 2 locations

@@ 54-71 (lines=18) @@
51
    /**
52
     * {@inheritDoc}
53
     */
54
    public function set($key, $value, $ttl = null) : bool
55
    {
56
        if ($ttl !== null) {
57
            if ($ttl instanceof \DateInterval) {
58
                $ttl = (new \DateTime())->setTimeStamp(0)->add($ttl)->getTimeStamp();
59
            }
60
61
            if (!is_integer($ttl)) {
62
                throw new InvalidArgumentException;
63
            }
64
65
            if ($ttl <= 0) {
66
                return $this->doctrineCache->delete($key);
67
            }
68
        }
69
70
        return $this->doctrineCache->save($key, $value, $ttl);
71
    }
72
73
    /**
74
     * {@inheritDoc}
@@ 100-117 (lines=18) @@
97
    /**
98
     * {@inheritDoc}
99
     */
100
    public function setMultiple($values, $ttl = null) : bool
101
    {
102
        if ($ttl !== null) {
103
            if ($ttl instanceof \DateInterval) {
104
                $ttl = (new \DateTime())->setTimeStamp(0)->add($ttl)->getTimeStamp();
105
            }
106
107
            if (!is_integer($ttl)) {
108
                throw new InvalidArgumentException;
109
            }
110
111
            if ($ttl <= 0) {
112
                return $this->deleteMultiple(array_keys($values));
113
            }
114
        }
115
116
        return $this->doctrineCache->saveMultiple($values, $ttl);
117
    }
118
119
    /**
120
     * {@inheritDoc}