class AcquiaPurgeStateCounter in Acquia Purge 7
Provides a single counter kept in state storage.
Hierarchy
- class \AcquiaPurgeStateItem implements AcquiaPurgeStateItemInterface
- class \AcquiaPurgeStateCounter implements AcquiaPurgeStateCounterInterface
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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AcquiaPurgeStateCounter:: |
public | function |
Decrease the counter. Overrides AcquiaPurgeStateCounterInterface:: |
|
AcquiaPurgeStateCounter:: |
public | function |
Increase the counter. Overrides AcquiaPurgeStateCounterInterface:: |
|
AcquiaPurgeStateCounter:: |
public | function |
Store the state item in state item storage. Overrides AcquiaPurgeStateItem:: |
|
AcquiaPurgeStateCounter:: |
public | function |
Construct a state item object. Overrides AcquiaPurgeStateItem:: |
|
AcquiaPurgeStateItem:: |
protected | property | The key with which the object is stored in state storage. | |
AcquiaPurgeStateItem:: |
protected | property | The state storage in which the item has been stored. | |
AcquiaPurgeStateItem:: |
protected | property | The value of the state item. | |
AcquiaPurgeStateItem:: |
public | function |
Get the item value. Overrides AcquiaPurgeStateItemInterface:: |
|
AcquiaPurgeStateItem:: |
public | function |
Get the item key. Overrides AcquiaPurgeStateItemInterface:: |