class RedirectResponseWithCookie in LDAP Single Sign On 8
Same name and namespace in other branches
- 8.4 src/RedirectResponseWithCookie.php \Drupal\ldap_sso\RedirectResponseWithCookie
An HTTP response doing a redirect and sending cookies.
@package AlterPHP.Component
@subpackage HttpFoundation
@author pcb <pc.bertineau@alterphp.com>
Hierarchy
- class \Drupal\ldap_sso\RedirectResponseWithCookie extends \Symfony\Component\HttpFoundation\RedirectResponse
Expanded class hierarchy of RedirectResponseWithCookie
1 file declares its use of RedirectResponseWithCookie
- LoginController.php in src/
Controller/ LoginController.php
File
- src/
RedirectResponseWithCookie.php, line 17
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. |