You are here

protected function SecuredRedirectResponse::fromResponse in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Component/HttpFoundation/SecuredRedirectResponse.php \Drupal\Component\HttpFoundation\SecuredRedirectResponse::fromResponse()

Copies over the values from the given response.

Parameters

\Symfony\Component\HttpFoundation\RedirectResponse $response: The redirect response object.

1 call to SecuredRedirectResponse::fromResponse()
CacheableSecuredRedirectResponse::fromResponse in core/lib/Drupal/Core/Routing/CacheableSecuredRedirectResponse.php
Copies over the values from the given response.
1 method overrides SecuredRedirectResponse::fromResponse()
CacheableSecuredRedirectResponse::fromResponse in core/lib/Drupal/Core/Routing/CacheableSecuredRedirectResponse.php
Copies over the values from the given response.

File

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

Class

SecuredRedirectResponse
Provides a common base class for safe redirects.

Namespace

Drupal\Component\HttpFoundation

Code

protected function fromResponse(RedirectResponse $response) {
  $this
    ->setProtocolVersion($response
    ->getProtocolVersion());
  if ($response
    ->getCharset()) {
    $this
      ->setCharset($response
      ->getCharset());
  }

  // Cookies are separate from other headers and have to be copied over
  // directly.
  foreach ($response->headers
    ->getCookies() as $cookie) {
    $this->headers
      ->setCookie($cookie);
  }
}