You are here

public function WildcardPathInvalidation::validateExpression in Purge 8.3

Validate the expression given to the invalidation during instantiation.

Throws

\Drupal\purge\Plugin\Purge\Invalidation\Exception\MissingExpressionException Thrown when plugin defined expression_required = TRUE and when it is instantiated without expression (NULL).

\Drupal\purge\Plugin\Purge\Invalidation\Exception\InvalidExpressionException Exception thrown when plugin got instantiated with an expression that is not deemed valid for the type of invalidation.

Overrides PathInvalidation::validateExpression

See also

\Drupal\purge\Annotation\PurgeInvalidation::$expression_required

\Drupal\purge\Annotation\PurgeInvalidation::$expression_can_be_empty

File

src/Plugin/Purge/Invalidation/WildcardPathInvalidation.php, line 25

Class

WildcardPathInvalidation
Describes wildcardpath based invalidation, e.g. "news/*".

Namespace

Drupal\purge\Plugin\Purge\Invalidation

Code

public function validateExpression($wildcard_check = TRUE) {
  parent::validateExpression(FALSE);
  if (strpos($this->expression, '*') === FALSE) {
    throw new InvalidExpressionException('Wildcard invalidations should contain an asterisk.');
  }
}