\Guzzle\Plugin\Cookie\CookieJarArrayCookieJar

Cookie cookieJar that stores cookies an an array

Summary

Methods
Properties
Constants
__construct()
setStrictMode()
remove()
removeTemporary()
removeExpired()
all()
add()
serialize()
unserialize()
count()
getIterator()
addCookiesFromResponse()
getMatchingCookies()
No public properties found
No constants found
No protected methods found
$cookies
$strictMode
N/A
removeCookieIfEmpty()
No private properties found
N/A

Properties

$cookies

$cookies : array

Type

array — Loaded cookie data

$strictMode

$strictMode : boolean

Type

boolean — Whether or not strict mode is enabled. When enabled, exceptions will be thrown for invalid cookies

Methods

__construct()

__construct(boolean  $strictMode = false) 

Parameters

boolean $strictMode

Set to true to throw exceptions when invalid cookies are added to the cookie jar

setStrictMode()

setStrictMode(boolean  $strictMode) : self

Enable or disable strict mode on the cookie jar

Parameters

boolean $strictMode

Set to true to throw exceptions when invalid cookies are added. False to ignore them.

Returns

self

remove()

remove(string  $domain = null, string  $path = null, string  $name = null) : \Guzzle\Plugin\Cookie\CookieJar\CookieJarInterface

Remove cookies currently held in the Cookie cookieJar.

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

string $domain

Set to clear only cookies matching a domain

string $path

Set to clear only cookies matching a domain and path

string $name

Set to clear only cookies matching a domain, path, and name

Returns

\Guzzle\Plugin\Cookie\CookieJar\CookieJarInterface

removeTemporary()

removeTemporary() : \Guzzle\Plugin\Cookie\CookieJar\CookieJarInterface

Discard all temporary cookies.

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.

Returns

\Guzzle\Plugin\Cookie\CookieJar\CookieJarInterface

all()

all(string  $domain = null, string  $path = null, string  $name = null, boolean  $skipDiscardable = false, boolean  $skipExpired = true) : array

Get all of the matching cookies

Parameters

string $domain

Domain of the cookie

string $path

Path of the cookie

string $name

Name of the cookie

boolean $skipDiscardable

Set to TRUE to skip cookies with the Discard attribute.

boolean $skipExpired

Set to FALSE to include expired

Returns

array —

Returns an array of Cookie objects

add()

add(\Guzzle\Plugin\Cookie\Cookie  $cookie) : boolean

Add a cookie to the cookie cookieJar

Parameters

\Guzzle\Plugin\Cookie\Cookie $cookie

Cookie to add

Returns

boolean —

Returns true on success or false on failure

serialize()

serialize() : string

Serializes the cookie cookieJar

Returns

string

unserialize()

unserialize(  $data) 

Unserializes the cookie cookieJar

Parameters

$data

count()

count() : integer

Returns the total number of stored cookies

Returns

integer

getIterator()

getIterator() : \ArrayIterator

Returns an iterator

Returns

\ArrayIterator

addCookiesFromResponse()

addCookiesFromResponse(\Guzzle\Http\Message\Response  $response, \Guzzle\Http\Message\RequestInterface  $request = null) 

Add cookies from a {@see Guzzle\Http\Message\Response} object

Parameters

\Guzzle\Http\Message\Response $response

Response object

\Guzzle\Http\Message\RequestInterface $request

Request that received the response

getMatchingCookies()

getMatchingCookies(\Guzzle\Http\Message\RequestInterface  $request) : array

Get cookies matching a request object

Parameters

\Guzzle\Http\Message\RequestInterface $request

Request object to match

Returns

array

removeCookieIfEmpty()

removeCookieIfEmpty(\Guzzle\Plugin\Cookie\Cookie  $cookie) 

If a cookie already exists and the server asks to set it again with a null value, the cookie must be deleted.

Parameters

\Guzzle\Plugin\Cookie\Cookie $cookie