| @@ 183-195 (lines=13) @@ | ||
| 180 | /** |
|
| 181 | * @inheritdoc |
|
| 182 | */ |
|
| 183 | public function incrementItemsByTag($tagName, $step = 1) |
|
| 184 | { |
|
| 185 | if (is_string($tagName) && is_int($step)) { |
|
| 186 | foreach ($this->getItemsByTag($tagName) as $item) { |
|
| 187 | $item->increment($step); |
|
| 188 | $this->saveDeferred($item); |
|
| 189 | } |
|
| 190 | ||
| 191 | return $this->commit(); |
|
| 192 | } else { |
|
| 193 | throw new InvalidArgumentException('$tagName must be a string and $step an integer'); |
|
| 194 | } |
|
| 195 | } |
|
| 196 | ||
| 197 | /** |
|
| 198 | * @inheritdoc |
|
| @@ 216-229 (lines=14) @@ | ||
| 213 | /** |
|
| 214 | * @inheritdoc |
|
| 215 | */ |
|
| 216 | public function incrementItemsByTagsAll(array $tagNames, $step = 1) |
|
| 217 | { |
|
| 218 | if (is_int($step)) { |
|
| 219 | $items = $this->getItemsByTagsAll($tagNames); |
|
| 220 | ||
| 221 | foreach ($items as $key => $item) { |
|
| 222 | $item->increment($step); |
|
| 223 | $this->saveDeferred($item); |
|
| 224 | } |
|
| 225 | return $this->commit(); |
|
| 226 | } else { |
|
| 227 | throw new InvalidArgumentException('$step must be an integer'); |
|
| 228 | } |
|
| 229 | } |
|
| 230 | ||
| 231 | /** |
|
| 232 | * @inheritdoc |
|
| @@ 234-246 (lines=13) @@ | ||
| 231 | /** |
|
| 232 | * @inheritdoc |
|
| 233 | */ |
|
| 234 | public function decrementItemsByTag($tagName, $step = 1) |
|
| 235 | { |
|
| 236 | if (is_string($tagName) && is_int($step)) { |
|
| 237 | foreach ($this->getItemsByTag($tagName) as $item) { |
|
| 238 | $item->decrement($step); |
|
| 239 | $this->saveDeferred($item); |
|
| 240 | } |
|
| 241 | ||
| 242 | return $this->commit(); |
|
| 243 | } else { |
|
| 244 | throw new InvalidArgumentException('$tagName must be a string and $step an integer'); |
|
| 245 | } |
|
| 246 | } |
|
| 247 | ||
| 248 | /** |
|
| 249 | * @inheritdoc |
|
| @@ 267-280 (lines=14) @@ | ||
| 264 | /** |
|
| 265 | * @inheritdoc |
|
| 266 | */ |
|
| 267 | public function decrementItemsByTagsAll(array $tagNames, $step = 1) |
|
| 268 | { |
|
| 269 | if (is_int($step)) { |
|
| 270 | $items = $this->getItemsByTagsAll($tagNames); |
|
| 271 | ||
| 272 | foreach ($items as $key => $item) { |
|
| 273 | $item->decrement($step); |
|
| 274 | $this->saveDeferred($item); |
|
| 275 | } |
|
| 276 | return $this->commit(); |
|
| 277 | } else { |
|
| 278 | throw new InvalidArgumentException('$step must be an integer'); |
|
| 279 | } |
|
| 280 | } |
|
| 281 | ||
| 282 | /** |
|
| 283 | * @inheritdoc |
|
| @@ 285-297 (lines=13) @@ | ||
| 282 | /** |
|
| 283 | * @inheritdoc |
|
| 284 | */ |
|
| 285 | public function appendItemsByTag($tagName, $data) |
|
| 286 | { |
|
| 287 | if (is_string($tagName)) { |
|
| 288 | foreach ($this->getItemsByTag($tagName) as $item) { |
|
| 289 | $item->append($data); |
|
| 290 | $this->saveDeferred($item); |
|
| 291 | } |
|
| 292 | ||
| 293 | return $this->commit(); |
|
| 294 | } else { |
|
| 295 | throw new InvalidArgumentException('$tagName must be a string'); |
|
| 296 | } |
|
| 297 | } |
|
| 298 | ||
| 299 | /** |
|
| 300 | * @inheritdoc |
|
| @@ 336-348 (lines=13) @@ | ||
| 333 | /** |
|
| 334 | * @inheritdoc |
|
| 335 | */ |
|
| 336 | public function prependItemsByTag($tagName, $data) |
|
| 337 | { |
|
| 338 | if (is_string($tagName)) { |
|
| 339 | foreach ($this->getItemsByTag($tagName) as $item) { |
|
| 340 | $item->prepend($data); |
|
| 341 | $this->saveDeferred($item); |
|
| 342 | } |
|
| 343 | ||
| 344 | return $this->commit(); |
|
| 345 | } else { |
|
| 346 | throw new InvalidArgumentException('$tagName must be a string'); |
|
| 347 | } |
|
| 348 | } |
|
| 349 | ||
| 350 | /** |
|
| 351 | * @inheritdoc |
|