Code Duplication    Length = 12-12 lines in 4 locations

src/phpFastCache/Core/DriverAbstract.php 4 locations

@@ 405-416 (lines=12) @@
402
    /**
403
     * @inheritdoc
404
     */
405
    public function incrementItemsByTag($tagName, $step = 1)
406
    {
407
        if (is_string($tagName) && is_int($step)) {
408
            foreach ($this->getItemsByTag($tagName) as $item) {
409
                $item->increment($step);
410
                $this->saveDeferred($item);
411
            }
412
            return $this->commit();
413
        } else {
414
            throw new InvalidArgumentException('$tagName must be a string and $step an integer');
415
        }
416
    }
417
418
    /**
419
     * @inheritdoc
@@ 438-449 (lines=12) @@
435
    /**
436
     * @inheritdoc
437
     */
438
    public function decrementItemsByTag($tagName, $step = 1)
439
    {
440
        if (is_string($tagName) && is_int($step)) {
441
            foreach ($this->getItemsByTag($tagName) as $item) {
442
                $item->decrement($step);
443
                $this->saveDeferred($item);
444
            }
445
            return $this->commit();
446
        } else {
447
            throw new InvalidArgumentException('$tagName must be a string and $step an integer');
448
        }
449
    }
450
451
    /**
452
     * @inheritdoc
@@ 471-482 (lines=12) @@
468
    /**
469
     * @inheritdoc
470
     */
471
    public function appendItemsByTag($tagName, $data)
472
    {
473
        if (is_string($tagName)) {
474
            foreach ($this->getItemsByTag($tagName) as $item) {
475
                $item->append($data);
476
                $this->saveDeferred($item);
477
            }
478
            return $this->commit();
479
        } else {
480
            throw new InvalidArgumentException('$tagName must be a string');
481
        }
482
    }
483
484
    /**
485
     * @inheritdoc
@@ 504-515 (lines=12) @@
501
    /**
502
     * @inheritdoc
503
     */
504
    public function prependItemsByTag($tagName, $data)
505
    {
506
        if (is_string($tagName)) {
507
            foreach ($this->getItemsByTag($tagName) as $item) {
508
                $item->prepend($data);
509
                $this->saveDeferred($item);
510
            }
511
            return $this->commit();
512
        } else {
513
            throw new InvalidArgumentException('$tagName must be a string');
514
        }
515
    }
516
517
    /**
518
     * @inheritdoc