CookieJarInterface
extends
Countable, IteratorAggregate
in
Interface for persisting cookies
Table of Contents
Methods
- add() : bool
- Add a cookie to the cookie cookieJar
- addCookiesFromResponse() : mixed
- Add cookies from a {@see Guzzle\Http\Message\Response} object
- all() : array<string|int, mixed>
- Get all of the matching cookies
- getMatchingCookies() : array<string|int, mixed>
- Get cookies matching a request object
- remove() : CookieJarInterface
- Remove cookies currently held in the Cookie cookieJar.
- removeExpired() : CookieJarInterface
- Delete any expired cookies
- removeTemporary() : CookieJarInterface
- Discard all temporary cookies.
Methods
add()
Add a cookie to the cookie cookieJar
public
add(Cookie $cookie) : bool
Parameters
- $cookie : Cookie
-
Cookie to add
Return values
bool —Returns true on success or false on failure
addCookiesFromResponse()
Add cookies from a {@see Guzzle\Http\Message\Response} object
public
addCookiesFromResponse(Response $response[, RequestInterface $request = null ]) : mixed
Parameters
- $response : Response
-
Response object
- $request : RequestInterface = null
-
Request that received the response
all()
Get all of the matching cookies
public
all([string $domain = null ][, string $path = null ][, string $name = null ][, bool $skipDiscardable = false ][, bool $skipExpired = true ]) : array<string|int, mixed>
Parameters
- $domain : string = null
-
Domain of the cookie
- $path : string = null
-
Path of the cookie
- $name : string = null
-
Name of the cookie
- $skipDiscardable : bool = false
-
Set to TRUE to skip cookies with the Discard attribute.
- $skipExpired : bool = true
-
Set to FALSE to include expired
Return values
array<string|int, mixed> —Returns an array of Cookie objects
getMatchingCookies()
Get cookies matching a request object
public
getMatchingCookies(RequestInterface $request) : array<string|int, mixed>
Parameters
- $request : RequestInterface
-
Request object to match
Return values
array<string|int, mixed>remove()
Remove cookies currently held in the Cookie cookieJar.
public
remove([string $domain = null ][, string $path = null ][, string $name = null ]) : CookieJarInterface
Invoking this method without arguments will empty the whole Cookie cookieJar. If given a $domain argument only cookies belonging to that domain will be removed. If given a $domain and $path argument, cookies belonging to the specified path within that domain are removed. If given all three arguments, then the cookie with the specified name, path and domain is removed.
Parameters
- $domain : string = null
-
Set to clear only cookies matching a domain
- $path : string = null
-
Set to clear only cookies matching a domain and path
- $name : string = null
-
Set to clear only cookies matching a domain, path, and name
Return values
CookieJarInterfaceremoveExpired()
Delete any expired cookies
public
removeExpired() : CookieJarInterface
Return values
CookieJarInterfaceremoveTemporary()
Discard all temporary cookies.
public
removeTemporary() : CookieJarInterface
Scans for all cookies in the cookieJar with either no expire field or a true discard flag. To be called when the user agent shuts down according to RFC 2965.