You are here

public function TxBuffer::getFiltered in Purge 8.3

Only retrieve items from the buffer in a particular given state(s).

Parameters

int|array $states: Individual state or array with one of the following states:

Return value

\Drupal\purge\Plugin\Purge\Invalidation\InvalidationInterface[] List of invalidation objects.

Overrides TxBufferInterface::getFiltered

File

src/Plugin/Purge/Queue/TxBuffer.php, line 92

Class

TxBuffer
Provides the transaction buffer.

Namespace

Drupal\purge\Plugin\Purge\Queue

Code

public function getFiltered($states) {
  if (!is_array($states)) {
    $states = [
      $states,
    ];
  }
  $results = [];
  foreach ($this->states as $id => $state) {
    if (in_array($state, $states)) {
      $results[] = $this->instances[$id];
    }
  }
  return $results;
}