You are here

class AcquiaPurgeStateCounter in Acquia Purge 7

Provides a single counter kept in state storage.

Hierarchy

Expanded class hierarchy of AcquiaPurgeStateCounter

File

lib/state/AcquiaPurgeStateCounter.php, line 11
Contains AcquiaPurgeStateCounter.

View source
class AcquiaPurgeStateCounter extends AcquiaPurgeStateItem implements AcquiaPurgeStateCounterInterface {

  /**
   * {@inheritdoc}
   */
  public function __construct(AcquiaPurgeStateStorageInterface $storage, $key, $value) {
    parent::__construct($storage, $key, $value);
    if (!is_int($this->value)) {
      $this->value = (int) $this->value;
    }
  }

  /**
   * {@inheritdoc}
   */
  public function decrease($amount = 1) {
    if (!is_int($amount)) {
      $amount = (int) $amount;
    }
    $this
      ->set($this->value - $amount);
  }

  /**
   * {@inheritdoc}
   */
  public function increase($amount = 1) {
    if (!is_int($amount)) {
      $amount = (int) $amount;
    }
    $this
      ->set($this->value + $amount);
  }

  /**
   * {@inheritdoc}
   */
  public function set($value) {
    if (!is_int($value)) {
      $value = (int) $value;
    }
    parent::set($value);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AcquiaPurgeStateCounter::decrease public function Decrease the counter. Overrides AcquiaPurgeStateCounterInterface::decrease
AcquiaPurgeStateCounter::increase public function Increase the counter. Overrides AcquiaPurgeStateCounterInterface::increase
AcquiaPurgeStateCounter::set public function Store the state item in state item storage. Overrides AcquiaPurgeStateItem::set
AcquiaPurgeStateCounter::__construct public function Construct a state item object. Overrides AcquiaPurgeStateItem::__construct
AcquiaPurgeStateItem::$key protected property The key with which the object is stored in state storage.
AcquiaPurgeStateItem::$storage protected property The state storage in which the item has been stored.
AcquiaPurgeStateItem::$value protected property The value of the state item.
AcquiaPurgeStateItem::get public function Get the item value. Overrides AcquiaPurgeStateItemInterface::get
AcquiaPurgeStateItem::getKey public function Get the item key. Overrides AcquiaPurgeStateItemInterface::getKey