You are here

class AcquiaPurgeStateItem in Acquia Purge 7

Provides a single state item kept in state storage.

Hierarchy

Expanded class hierarchy of AcquiaPurgeStateItem

File

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

View source
class AcquiaPurgeStateItem implements AcquiaPurgeStateItemInterface {

  /**
   * The state storage in which the item has been stored.
   *
   * @var AcquiaPurgeStateStorageInterface
   */
  protected $storage;

  /**
   * The key with which the object is stored in state storage.
   *
   * @var string
   */
  protected $key;

  /**
   * The value of the state item.
   *
   * @var mixed
   */
  protected $value;

  /**
   * {@inheritdoc}
   */
  public function __construct(AcquiaPurgeStateStorageInterface $storage, $key, $value) {
    $this->storage = $storage;
    $this->value = $value;
    $this->key = $key;
  }

  /**
   * {@inheritdoc}
   */
  public function get() {
    return $this->value;
  }

  /**
   * {@inheritdoc}
   */
  public function getKey() {
    return $this->key;
  }

  /**
   * {@inheritdoc}
   */
  public function set($value) {
    $this->value = $value;
    $this->storage
      ->set($this);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
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
AcquiaPurgeStateItem::set public function Store the state item in state item storage. Overrides AcquiaPurgeStateItemInterface::set 1
AcquiaPurgeStateItem::__construct public function Construct a state item object. Overrides AcquiaPurgeStateItemInterface::__construct 1