Code Duplication    Length = 13-13 lines in 4 locations

src/phpFastCache/Core/Pool/ExtendedCacheItemPoolTrait.php 4 locations

@@ 170-182 (lines=13) @@
167
    /**
168
     * @inheritdoc
169
     */
170
    public function incrementItemsByTag($tagName, $step = 1)
171
    {
172
        if (is_string($tagName) && is_int($step)) {
173
            foreach ($this->getItemsByTag($tagName) as $item) {
174
                $item->increment($step);
175
                $this->saveDeferred($item);
176
            }
177
178
            return $this->commit();
179
        } else {
180
            throw new InvalidArgumentException('$tagName must be a string and $step an integer');
181
        }
182
    }
183
184
    /**
185
     * @inheritdoc
@@ 203-215 (lines=13) @@
200
    /**
201
     * @inheritdoc
202
     */
203
    public function decrementItemsByTag($tagName, $step = 1)
204
    {
205
        if (is_string($tagName) && is_int($step)) {
206
            foreach ($this->getItemsByTag($tagName) as $item) {
207
                $item->decrement($step);
208
                $this->saveDeferred($item);
209
            }
210
211
            return $this->commit();
212
        } else {
213
            throw new InvalidArgumentException('$tagName must be a string and $step an integer');
214
        }
215
    }
216
217
    /**
218
     * @inheritdoc
@@ 236-248 (lines=13) @@
233
    /**
234
     * @inheritdoc
235
     */
236
    public function appendItemsByTag($tagName, $data)
237
    {
238
        if (is_string($tagName)) {
239
            foreach ($this->getItemsByTag($tagName) as $item) {
240
                $item->append($data);
241
                $this->saveDeferred($item);
242
            }
243
244
            return $this->commit();
245
        } else {
246
            throw new InvalidArgumentException('$tagName must be a string');
247
        }
248
    }
249
250
    /**
251
     * @inheritdoc
@@ 269-281 (lines=13) @@
266
    /**
267
     * @inheritdoc
268
     */
269
    public function prependItemsByTag($tagName, $data)
270
    {
271
        if (is_string($tagName)) {
272
            foreach ($this->getItemsByTag($tagName) as $item) {
273
                $item->prepend($data);
274
                $this->saveDeferred($item);
275
            }
276
277
            return $this->commit();
278
        } else {
279
            throw new InvalidArgumentException('$tagName must be a string');
280
        }
281
    }
282
283
    /**
284
     * @inheritdoc