$cookies
$cookies : array<mixed,\Cake\Http\Cookie\CookieInterface>
Cookie objects
Container class for cookies used in Http\Client.
Provides cookie jar like features for storing cookies between requests, as well as appending cookies to new requests.
$cookies : array<mixed,\Cake\Http\Cookie\CookieInterface>
Cookie objects
createFromServerRequest(\Psr\Http\Message\ServerRequestInterface $request) : static
Create a new collection from the cookies in a ServerRequest
\Psr\Http\Message\ServerRequestInterface | $request | The request to extract cookie data from |
add(\Cake\Http\Cookie\CookieInterface $cookie) : static
Add a cookie and get an updated collection.
Cookies are stored by id. This means that there can be duplicate cookies if a cookie collection is used for cookies across multiple domains. This can impact how get(), has() and remove() behave.
\Cake\Http\Cookie\CookieInterface | $cookie | Cookie instance to add. |
addToRequest(\Psr\Http\Message\RequestInterface $request, array $extraCookies = array()) : \Psr\Http\Message\RequestInterface
Add cookies that match the path/domain/expiration to the request.
This allows CookieCollections to be used as a 'cookie jar' in an HTTP client situation. Cookies that match the request's domain + path that are not expired when this method is called will be applied to the request.
\Psr\Http\Message\RequestInterface | $request | The request to update. |
array | $extraCookies | Associative array of additional cookies to add into the request. This is useful when you have cookie data from outside the collection you want to send. |
An updated request.
addFromResponse(\Psr\Http\Message\ResponseInterface $response, \Psr\Http\Message\RequestInterface $request) : static
Create a new collection that includes cookies from the response.
\Psr\Http\Message\ResponseInterface | $response | Response to extract cookies from. |
\Psr\Http\Message\RequestInterface | $request | Request to get cookie context from. |
store(\Cake\Http\Client\Response $response, string $url) : void
Store the cookies from a response.
Store the cookies that haven't expired. If a cookie has been expired and is currently stored, it will be removed.
\Cake\Http\Client\Response | $response | The response to read cookies from |
string | $url | The request URL used for default host/path values. |
findMatchingCookies(string $scheme, string $host, string $path) : array
Find cookies matching the scheme, host, and path
string | $scheme | The http scheme to match |
string | $host | The host to match. |
string | $path | The path to match |
An array of cookie name/value pairs
setRequestDefaults(array $cookies, string $host, string $path) : array
Apply path and host to the set of cookies if they are not set.
array | $cookies | An array of cookies to update. |
string | $host | The host to set. |
string | $path | The path to set. |
An array of updated cookies.
parseSetCookieHeader(array $values) : array<mixed,\Cake\Http\Cookie\Cookie>
Parse Set-Cookie headers into array
array | $values | List of Set-Cookie Header values. |
An array of cookie objects
convertCookieToArray(\Cake\Http\Cookie\CookieInterface $cookie) : array
Convert the cookie into an array of its properties.
Primarily useful where backwards compatibility is needed.
\Cake\Http\Cookie\CookieInterface | $cookie | Cookie object. |
Loading…