protected function SecuredRedirectResponse::fromResponse

protected SecuredRedirectResponse::fromResponse(RedirectResponse $response)

Copies over the values from the given response.

Parameters

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

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());
  $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);
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!HttpFoundation!SecuredRedirectResponse.php/function/SecuredRedirectResponse::fromResponse/8.1.x