Code Duplication    Length = 13-13 lines in 4 locations

src/phpFastCache/Core/ExtendedCacheItemPoolTrait.php 4 locations

@@ 156-168 (lines=13) @@
153
    /**
154
     * @inheritdoc
155
     */
156
    public function incrementItemsByTag($tagName, $step = 1)
157
    {
158
        if (is_string($tagName) && is_int($step)) {
159
            foreach ($this->getItemsByTag($tagName) as $item) {
160
                $item->increment($step);
161
                $this->saveDeferred($item);
162
            }
163
164
            return $this->commit();
165
        } else {
166
            throw new InvalidArgumentException('$tagName must be a string and $step an integer');
167
        }
168
    }
169
170
    /**
171
     * @inheritdoc
@@ 189-201 (lines=13) @@
186
    /**
187
     * @inheritdoc
188
     */
189
    public function decrementItemsByTag($tagName, $step = 1)
190
    {
191
        if (is_string($tagName) && is_int($step)) {
192
            foreach ($this->getItemsByTag($tagName) as $item) {
193
                $item->decrement($step);
194
                $this->saveDeferred($item);
195
            }
196
197
            return $this->commit();
198
        } else {
199
            throw new InvalidArgumentException('$tagName must be a string and $step an integer');
200
        }
201
    }
202
203
    /**
204
     * @inheritdoc
@@ 222-234 (lines=13) @@
219
    /**
220
     * @inheritdoc
221
     */
222
    public function appendItemsByTag($tagName, $data)
223
    {
224
        if (is_string($tagName)) {
225
            foreach ($this->getItemsByTag($tagName) as $item) {
226
                $item->append($data);
227
                $this->saveDeferred($item);
228
            }
229
230
            return $this->commit();
231
        } else {
232
            throw new InvalidArgumentException('$tagName must be a string');
233
        }
234
    }
235
236
    /**
237
     * @inheritdoc
@@ 255-267 (lines=13) @@
252
    /**
253
     * @inheritdoc
254
     */
255
    public function prependItemsByTag($tagName, $data)
256
    {
257
        if (is_string($tagName)) {
258
            foreach ($this->getItemsByTag($tagName) as $item) {
259
                $item->prepend($data);
260
                $this->saveDeferred($item);
261
            }
262
263
            return $this->commit();
264
        } else {
265
            throw new InvalidArgumentException('$tagName must be a string');
266
        }
267
    }
268
269
    /**
270
     * @inheritdoc