You are here

public function SecuredRedirectResponse::setTargetUrl in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Component/HttpFoundation/SecuredRedirectResponse.php \Drupal\Component\HttpFoundation\SecuredRedirectResponse::setTargetUrl()
1 call to SecuredRedirectResponse::setTargetUrl()
TrustedRedirectResponse::setTrustedTargetUrl in core/lib/Drupal/Core/Routing/TrustedRedirectResponse.php
Sets the target URL to a trusted URL.

File

core/lib/Drupal/Component/HttpFoundation/SecuredRedirectResponse.php, line 56

Class

SecuredRedirectResponse
Provides a common base class for safe redirects.

Namespace

Drupal\Component\HttpFoundation

Code

public function setTargetUrl($url) {
  if (!$this
    ->isSafe($url)) {
    throw new \InvalidArgumentException(sprintf('It is not safe to redirect to %s', $url));
  }
  return parent::setTargetUrl($url);
}