25 $this->setCookies[$setCookie->getName()] = $setCookie;
35 return isset($this->setCookies[
$name]);
48 return $this->setCookies[
$name];
56 return array_values($this->setCookies);
65 $clone = clone($this);
67 $clone->setCookies[$setCookie->
getName()] = $setCookie;
78 $clone = clone($this);
80 if (! $clone->has(
$name)) {
84 unset($clone->setCookies[
$name]);
97 $response = $response->
withoutHeader(static::SET_COOKIE_HEADER);
98 foreach ($this->setCookies as $setCookie) {
99 $response = $response->
withAddedHeader(static::SET_COOKIE_HEADER, (
string) $setCookie);
113 return new static(array_map(
function ($setCookieString) {
114 return SetCookie::fromSetCookieString($setCookieString);
115 }, $setCookieStrings));
126 return new static(array_map(
function ($setCookieString) {
127 return SetCookie::fromSetCookieString($setCookieString);
128 }, $response->
getHeader(static::SET_COOKIE_HEADER)));
with(SetCookie $setCookie)
withoutHeader($name)
Return an instance without the specified header.
renderIntoSetCookieHeader(ResponseInterface $response)
Render SetCookies into a Response.
static fromResponse(ResponseInterface $response)
Create SetCookies from a Response.
static fromSetCookieStrings($setCookieStrings)
Create SetCookies from a collection of SetCookie header value strings.
const SET_COOKIE_HEADER
The name of the Set-Cookie header.
getHeader($name)
Retrieves a message header value by the given case-insensitive name.
Representation of an outgoing, server-side response.
withAddedHeader($name, $value)
Return an instance with the specified header appended with the given value.
__construct(array $setCookies=[])
Create styles array
The data for the language used.