Class CookieJar
Cookie jar that stores cookies as an array
-
GuzzleHttp\Cookie\CookieJar
implements
GuzzleHttp\Cookie\CookieJarInterface
Methods summary
public
|
#
__construct( boolean $strictMode = false, array $cookieArray = [] )
Parameters
- $strictMode
Set to true to throw exceptions when invalid
cookies are added to the cookie jar.
- $cookieArray
Array of SetCookie objects or a hash of
arrays that can be used with the SetCookie
constructor
|
public static
GuzzleHttp\Cookie\CookieJar
|
#
fromArray( array $cookies, string $domain )
Create a new Cookie jar from an associative array and domain.
Create a new Cookie jar from an associative array and domain.
Parameters
- $cookies
- Cookies to create the jar from
- $domain
- Domain to set the cookies to
Returns
|
public static
|
|
public static
boolean
|
#
shouldPersist( GuzzleHttp\Cookie\SetCookie $cookie, boolean $allowSessionCookies = false )
Evaluate if this cookie should be persisted to storage
that survives between requests.
Evaluate if this cookie should be persisted to storage
that survives between requests.
Parameters
- $cookie
- Being evaluated.
- $allowSessionCookies
- If we should persist session cookies
Returns
boolean
|
public
array
|
#
toArray( )
Converts the cookie jar to an array.
Converts the cookie jar to an array.
Returns
array
Implementation of
|
public
GuzzleHttp\Cookie\CookieJarInterface
|
#
clear( string $domain = null, string $path = null, string $name = null )
Remove cookies currently held in the cookie jar.
Remove cookies currently held in the cookie jar.
Invoking this method without arguments will empty the whole cookie jar.
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
- Clears cookies matching a domain
- $path
- Clears cookies matching a domain and path
- $name
- Clears cookies matching a domain, path, and name
Returns
Implementation of
|
public
|
#
clearSessionCookies( )
Discard all sessions cookies.
Discard all sessions cookies.
Removes cookies that don't have an expire field or a have a discard
field set to true. To be called when the user agent shuts down according
to RFC 2965.
Implementation of
|
public
boolean
|
#
setCookie( GuzzleHttp\Cookie\SetCookie $cookie )
Sets a cookie in the cookie jar.
Sets a cookie in the cookie jar.
Parameters
Returns
boolean Returns true on success or false on failure
Implementation of
|
public
|
#
count( )
Implementation of
Countable::count()
|
public
|
#
getIterator( )
Implementation of
IteratorAggregate::getIterator()
|