public function InvalidationBase::setState in Purge 8.3
Set the state of the invalidation.
Setting state on invalidation objects is the responsibility of purgers, as only purgers decide what succeeded and what failed. For this reason a call to ::setStateContext() before the state is set, is obligatory.
Parameters
int $state: One of the following states:
- InvStatesInterface::SUCCEEDED
- InvStatesInterface::FAILED
- InvStatesInterface::PROCESSING
- InvStatesInterface::NOT_SUPPORTED.
Throws
\Drupal\purge\Plugin\Purge\Invalidation\Exception\InvalidStateException Thrown when the $state parameter doesn't match any of the constants defined in \Drupal\purge\Plugin\Purge\Invalidation\InvStatesInterface.
\LogicException Thrown when the state is being set in general context.
Overrides InvalidationInterface::setState
File
- src/
Plugin/ Purge/ Invalidation/ InvalidationBase.php, line 109
Class
- InvalidationBase
- Provides base implementations for the invalidation object.
Namespace
Drupal\purge\Plugin\Purge\InvalidationCode
public function setState($state) {
if (!is_int($state)) {
throw new InvalidStateException('$state not an integer!');
}
if ($state < 0 || $state > 4) {
throw new InvalidStateException('$state is out of range!');
}
if (is_null($this->context)) {
throw new \LogicException('State cannot be set in NULL context!');
}
$this->states[$this->context] = $state;
}