Code Duplication    Length = 12-12 lines in 4 locations

src/phpFastCache/Core/ExtendedCacheItemPoolTrait.php 4 locations

@@ 132-143 (lines=12) @@
129
    /**
130
     * @inheritdoc
131
     */
132
    public function incrementItemsByTag($tagName, $step = 1)
133
    {
134
        if (is_string($tagName) && is_int($step)) {
135
            foreach ($this->getItemsByTag($tagName) as $item) {
136
                $item->increment($step);
137
                $this->saveDeferred($item);
138
            }
139
140
            return $this->commit();
141
        } else {
142
            throw new InvalidArgumentException('$tagName must be a string and $step an integer');
143
        }
144
    }
145
146
    /**
@@ 165-176 (lines=12) @@
162
    /**
163
     * @inheritdoc
164
     */
165
    public function decrementItemsByTag($tagName, $step = 1)
166
    {
167
        if (is_string($tagName) && is_int($step)) {
168
            foreach ($this->getItemsByTag($tagName) as $item) {
169
                $item->decrement($step);
170
                $this->saveDeferred($item);
171
            }
172
173
            return $this->commit();
174
        } else {
175
            throw new InvalidArgumentException('$tagName must be a string and $step an integer');
176
        }
177
    }
178
179
    /**
@@ 198-209 (lines=12) @@
195
    /**
196
     * @inheritdoc
197
     */
198
    public function appendItemsByTag($tagName, $data)
199
    {
200
        if (is_string($tagName)) {
201
            foreach ($this->getItemsByTag($tagName) as $item) {
202
                $item->append($data);
203
                $this->saveDeferred($item);
204
            }
205
206
            return $this->commit();
207
        } else {
208
            throw new InvalidArgumentException('$tagName must be a string');
209
        }
210
    }
211
212
    /**
@@ 231-242 (lines=12) @@
228
    /**
229
     * @inheritdoc
230
     */
231
    public function prependItemsByTag($tagName, $data)
232
    {
233
        if (is_string($tagName)) {
234
            foreach ($this->getItemsByTag($tagName) as $item) {
235
                $item->prepend($data);
236
                $this->saveDeferred($item);
237
            }
238
239
            return $this->commit();
240
        } else {
241
            throw new InvalidArgumentException('$tagName must be a string');
242
        }
243
    }
244
245
    /**