public function UrlInvalidation::getUrl in Purge 8.3
Get the URL object.
Return value
\Drupal\Core\Url The url object.
File
- src/
Plugin/ Purge/ Invalidation/ UrlInvalidation.php, line 43
Class
- UrlInvalidation
- Describes URL based invalidation, e.g. "http://site.com/node/1".
Namespace
Drupal\purge\Plugin\Purge\InvalidationCode
public function getUrl() {
if (!is_null($this->url)) {
return $this->url;
}
if (is_string($this->expression)) {
try {
$this->url = Url::fromUri($this->expression, [
'absolute' => TRUE,
]);
} catch (\InvalidArgumentException $e) {
throw new InvalidExpressionException($e
->getMessage());
}
}
elseif ($this->expression instanceof Url) {
$this->url = $this->expression;
$this->url
->setAbsolute();
}
else {
throw new InvalidExpressionException('Url invalidations require either a full URL string or a \\Drupal\\Core\\Url object.');
}
return $this->url;
}