PathInvalidation.php in Purge 8.3
File
src/Plugin/Purge/Invalidation/PathInvalidation.php
View source
<?php
namespace Drupal\purge\Plugin\Purge\Invalidation;
use Drupal\purge\Plugin\Purge\Invalidation\Exception\InvalidExpressionException;
class PathInvalidation extends InvalidationBase implements InvalidationInterface {
public function validateExpression($wildcard_check = TRUE) {
parent::validateExpression();
if ($wildcard_check && strpos($this->expression, '*') !== FALSE) {
throw new InvalidExpressionException('Path invalidations should not contain asterisks.');
}
if ($wildcard_check && $this->expression === '*') {
throw new InvalidExpressionException('Path invalidations cannot be "*".');
}
if (strpos($this->expression, ' ') !== FALSE) {
throw new InvalidExpressionException('Path invalidations cannot contain spaces, use %20 instead.');
}
if (strpos($this->expression, '/') === 0) {
throw new InvalidExpressionException('Path invalidations cannot start with slashes.');
}
}
}