Code Duplication    Length = 12-12 lines in 4 locations

src/phpFastCache/Core/ExtendedCacheItemPoolTrait.php 4 locations

@@ 100-111 (lines=12) @@
97
    /**
98
     * @inheritdoc
99
     */
100
    public function incrementItemsByTag($tagName, $step = 1)
101
    {
102
        if (is_string($tagName) && is_int($step)) {
103
            foreach ($this->getItemsByTag($tagName) as $item) {
104
                $item->increment($step);
105
                $this->saveDeferred($item);
106
            }
107
            return $this->commit();
108
        } else {
109
            throw new InvalidArgumentException('$tagName must be a string and $step an integer');
110
        }
111
    }
112
113
    /**
114
     * @inheritdoc
@@ 133-144 (lines=12) @@
130
    /**
131
     * @inheritdoc
132
     */
133
    public function decrementItemsByTag($tagName, $step = 1)
134
    {
135
        if (is_string($tagName) && is_int($step)) {
136
            foreach ($this->getItemsByTag($tagName) as $item) {
137
                $item->decrement($step);
138
                $this->saveDeferred($item);
139
            }
140
            return $this->commit();
141
        } else {
142
            throw new InvalidArgumentException('$tagName must be a string and $step an integer');
143
        }
144
    }
145
146
    /**
147
     * @inheritdoc
@@ 166-177 (lines=12) @@
163
    /**
164
     * @inheritdoc
165
     */
166
    public function appendItemsByTag($tagName, $data)
167
    {
168
        if (is_string($tagName)) {
169
            foreach ($this->getItemsByTag($tagName) as $item) {
170
                $item->append($data);
171
                $this->saveDeferred($item);
172
            }
173
            return $this->commit();
174
        } else {
175
            throw new InvalidArgumentException('$tagName must be a string');
176
        }
177
    }
178
179
    /**
180
     * @inheritdoc
@@ 199-210 (lines=12) @@
196
    /**
197
     * @inheritdoc
198
     */
199
    public function prependItemsByTag($tagName, $data)
200
    {
201
        if (is_string($tagName)) {
202
            foreach ($this->getItemsByTag($tagName) as $item) {
203
                $item->prepend($data);
204
                $this->saveDeferred($item);
205
            }
206
            return $this->commit();
207
        } else {
208
            throw new InvalidArgumentException('$tagName must be a string');
209
        }
210
    }
211
212
    /**
213
     * @inheritdoc