You are here

public function ProxyItem::__get in Purge 8.3

Retrieve a property.

Parameters

string $name: The name of the property, can be 'item_id', 'created' or 'data'.

Return value

mixed The property value.

Throws

\Drupal\purge\Plugin\Purge\Queue\Exception\InvalidPropertyException Thrown when the requested property isn't 'item_id', 'created' or 'data'.

Overrides ProxyItemInterface::__get

See also

http://php.net/manual/en/language.oop5.overloading.php#object.get

File

src/Plugin/Purge/Queue/ProxyItem.php, line 86

Class

ProxyItem
Provides a proxy item.

Namespace

Drupal\purge\Plugin\Purge\Queue

Code

public function __get($name) {
  if (!isset($this->properties[$name])) {
    throw new InvalidPropertyException("The property '{$name}' does not exist.");
  }

  // The 'data' property describes the purge queue item in such a way that
  // \Drupal\purge\Plugin\Purge\Invalidation\InvalidationsServiceInterface is
  // able to recreate it easily.
  if ($name === 'data') {
    return [
      self::DATA_INDEX_TYPE => $this->invalidation
        ->getType(),
      self::DATA_INDEX_STATES => $this->invalidation
        ->getStates(),
      self::DATA_INDEX_EXPRESSION => $this->invalidation
        ->getExpression(),
      self::DATA_INDEX_PROPERTIES => $this->invalidation
        ->getProperties(),
    ];
  }
  else {
    return $this->buffer
      ->getProperty($this->invalidation, $name, NULL);
  }
}