class RedirectResponseWithCookie in LDAP Single Sign On 8.4
Same name and namespace in other branches
- 8 src/RedirectResponseWithCookie.php \Drupal\ldap_sso\RedirectResponseWithCookie
Taken from AlterPHP\Component\HttpFoundation.
Hierarchy
- class \Drupal\ldap_sso\RedirectResponseWithCookie extends \Symfony\Component\HttpFoundation\RedirectResponse
Expanded class hierarchy of RedirectResponseWithCookie
See also
https://github.com/alterphp/components/blob/master/src/AlterPHP/Componen...
1 file declares its use of RedirectResponseWithCookie
- LoginController.php in src/Controller/ LoginController.php 
File
- src/RedirectResponseWithCookie.php, line 15 
Namespace
Drupal\ldap_ssoView source
class RedirectResponseWithCookie extends RedirectResponse {
  /**
   * Creates a valid redirect response and pushes cookies with them.
   *
   * @param string $url
   *   The URL to redirect to.
   * @param int $status
   *   The status code (302 by default)
   * @param array $cookies
   *   An array of Cookie objects.
   */
  public function __construct($url, $status = 302, array $cookies = []) {
    parent::__construct($url, $status);
    foreach ($cookies as $cookie) {
      if (!$cookie instanceof Cookie) {
        throw new \InvalidArgumentException(sprintf('One of third parameter array is not a valid Cookie object.'));
      }
      $this->headers
        ->setCookie($cookie);
    }
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| RedirectResponseWithCookie:: | public | function | Creates a valid redirect response and pushes cookies with them. | 
