@@ 174-186 (lines=13) @@ | ||
171 | /** |
|
172 | * @inheritdoc |
|
173 | */ |
|
174 | public function incrementItemsByTag($tagName, $step = 1) |
|
175 | { |
|
176 | if (is_string($tagName) && is_int($step)) { |
|
177 | foreach ($this->getItemsByTag($tagName) as $item) { |
|
178 | $item->increment($step); |
|
179 | $this->saveDeferred($item); |
|
180 | } |
|
181 | ||
182 | return $this->commit(); |
|
183 | } else { |
|
184 | throw new InvalidArgumentException('$tagName must be a string and $step an integer'); |
|
185 | } |
|
186 | } |
|
187 | ||
188 | /** |
|
189 | * @inheritdoc |
|
@@ 207-220 (lines=14) @@ | ||
204 | /** |
|
205 | * @inheritdoc |
|
206 | */ |
|
207 | public function incrementItemsByTagsAll(array $tagNames, $step = 1) |
|
208 | { |
|
209 | if (is_int($step)) { |
|
210 | $items = $this->getItemsByTagsAll($tagNames); |
|
211 | ||
212 | foreach ($items as $key => $item) { |
|
213 | $item->increment($step); |
|
214 | $this->saveDeferred($item); |
|
215 | } |
|
216 | return $this->commit(); |
|
217 | } else { |
|
218 | throw new InvalidArgumentException('$step must be an integer'); |
|
219 | } |
|
220 | } |
|
221 | ||
222 | /** |
|
223 | * @inheritdoc |
|
@@ 225-237 (lines=13) @@ | ||
222 | /** |
|
223 | * @inheritdoc |
|
224 | */ |
|
225 | public function decrementItemsByTag($tagName, $step = 1) |
|
226 | { |
|
227 | if (is_string($tagName) && is_int($step)) { |
|
228 | foreach ($this->getItemsByTag($tagName) as $item) { |
|
229 | $item->decrement($step); |
|
230 | $this->saveDeferred($item); |
|
231 | } |
|
232 | ||
233 | return $this->commit(); |
|
234 | } else { |
|
235 | throw new InvalidArgumentException('$tagName must be a string and $step an integer'); |
|
236 | } |
|
237 | } |
|
238 | ||
239 | /** |
|
240 | * @inheritdoc |
|
@@ 258-271 (lines=14) @@ | ||
255 | /** |
|
256 | * @inheritdoc |
|
257 | */ |
|
258 | public function decrementItemsByTagsAll(array $tagNames, $step = 1) |
|
259 | { |
|
260 | if (is_int($step)) { |
|
261 | $items = $this->getItemsByTagsAll($tagNames); |
|
262 | ||
263 | foreach ($items as $key => $item) { |
|
264 | $item->decrement($step); |
|
265 | $this->saveDeferred($item); |
|
266 | } |
|
267 | return $this->commit(); |
|
268 | } else { |
|
269 | throw new InvalidArgumentException('$step must be an integer'); |
|
270 | } |
|
271 | } |
|
272 | ||
273 | /** |
|
274 | * @inheritdoc |
|
@@ 276-288 (lines=13) @@ | ||
273 | /** |
|
274 | * @inheritdoc |
|
275 | */ |
|
276 | public function appendItemsByTag($tagName, $data) |
|
277 | { |
|
278 | if (is_string($tagName)) { |
|
279 | foreach ($this->getItemsByTag($tagName) as $item) { |
|
280 | $item->append($data); |
|
281 | $this->saveDeferred($item); |
|
282 | } |
|
283 | ||
284 | return $this->commit(); |
|
285 | } else { |
|
286 | throw new InvalidArgumentException('$tagName must be a string'); |
|
287 | } |
|
288 | } |
|
289 | ||
290 | /** |
|
291 | * @inheritdoc |
|
@@ 327-339 (lines=13) @@ | ||
324 | /** |
|
325 | * @inheritdoc |
|
326 | */ |
|
327 | public function prependItemsByTag($tagName, $data) |
|
328 | { |
|
329 | if (is_string($tagName)) { |
|
330 | foreach ($this->getItemsByTag($tagName) as $item) { |
|
331 | $item->prepend($data); |
|
332 | $this->saveDeferred($item); |
|
333 | } |
|
334 | ||
335 | return $this->commit(); |
|
336 | } else { |
|
337 | throw new InvalidArgumentException('$tagName must be a string'); |
|
338 | } |
|
339 | } |
|
340 | ||
341 | /** |
|
342 | * @inheritdoc |