addCookie()
addCookiesFromResponse()
count()
fromArray()
fromResponse()
fromString()
get()
getAllCookies()
getCookie()
getIterator()
getMatchingCookies()
isEmpty()
offsetExists()
offsetGet()
offsetSet()
offsetUnset()
reset()
serialize()
set()
toArray()
toString()
unserialize()
_flattenCookiesArray()
_matchDomain()
_matchPath()
$cookies
$rawCookies
COOKIE_OBJECT
COOKIE_STRING_ARRAY
COOKIE_STRING_CONCAT
A Cookies object is designed to contain and maintain HTTP cookies, and should be used along with Zend\Http\Client in order to manage cookies across HTTP requests and responses.
The class contains an array of Zend\Http\Header\Cookie objects. Cookies can be added automatically from a request or manually. Then, the Cookies class can find and return the cookies needed for a specific HTTP request.
A special parameter can be passed to all methods of this class that return cookies: Cookies can be returned either in their native form (as Zend\Http\Header\Cookie objects) or as strings - the later is suitable for sending as the value of the "Cookie" header in an HTTP request. You can also choose, when returning more than one cookie, whether to get an array of strings (by passing Zend\Http\Client\Cookies::COOKIE_STRING_ARRAY) or one unified string for all cookies (by passing Zend\Http\Client\Cookies::COOKIE_STRING_CONCAT).
link | for some specs. |
---|
addCookie(\Zend\Http\Header\SetCookie | string $cookie, \Zend\Uri\Uri | string $refUri)
Cookie should be passed either as a Zend\Http\Header\Cookie object or as a string - in which case an object is created from the string.
\Zend\Http\Header\SetCookiestring
\Zend\Http\Client\Exception\InvalidArgumentException |
if invalid $cookie value |
---|
addCookiesFromResponse(\Zend\Http\Response $response, \Zend\Uri\Uri | string $refUri)
count() : int
int
fromArray(array $values)
fromResponse(\Zend\Http\Response $response, \Zend\Uri\Uri | string $refUri) : \Zend\Http\Client\Cookies
If $uri is set, it will be considered as the requested URI for setting default domain and path of the cookie.
todo | Add the $uri functionality. |
---|
fromString($string)
get($name, $default)
getAllCookies(int $retAs) : array | string
int
Whether to return cookies as objects of \Zend\Http\Header\Cookie or as strings
array
string
getCookie(\Zend\Uri\Uri | string $uri, string $cookieName, int $retAs) : \Zend\Http\Client\Cookie | string
string
The cookie's name
int
Whether to return cookies as objects of \Zend\Http\Header\Cookie or as strings
\Zend\Http\Client\Exception\InvalidArgumentException |
if invalid URI specified or invalid $retAs value |
---|
\Zend\Http\Client\Cookie
string
getMatchingCookies(string | \Zend\Uri\Uri $uri, bool $matchSessionCookies, int $retAs, int $now) : array | string
bool
Whether to send session cookies
int
Whether to return cookies as objects of \Zend\Http\Header\Cookie or as strings
int
Override the current time when checking for expiry time
\Zend\Http\Client\Exception\InvalidArgumentException |
if invalid URI |
---|
array
string
isEmpty() : bool
bool
offsetExists(mixed $offset) : bool
link | http://php.net/manual/en/arrayaccess.offsetexists.php |
---|
mixed
An offset to check for.
bool
Returns true on success or false on failure. The return value will be casted to boolean if non-boolean was returned.
offsetGet(mixed $offset) : mixed
link | http://php.net/manual/en/arrayaccess.offsetget.php |
---|
mixed
The offset to retrieve.
mixed
Can return all value types.offsetSet(mixed $offset, mixed $value) : void
link | http://php.net/manual/en/arrayaccess.offsetset.php |
---|
mixed
The offset to assign the value to.
mixed
The value to set.
offsetUnset(mixed $offset) : void
link | http://php.net/manual/en/arrayaccess.offsetunset.php |
---|
mixed
The offset to unset.
serialize() : string
link | http://php.net/manual/en/serializable.serialize.php |
---|
string
the string representation of the object or &null;set($name, $value)
toArray()
toString()
unserialize(string $serialized) : mixed
link | http://php.net/manual/en/serializable.unserialize.php |
---|
string
The string representation of the object.
mixed
the original value unserialized._flattenCookiesArray(\Zend\Http\Header\Cookie | array $ptr, int $retAs) : array | string
Should be used when exporting the cookies array (or parts of it)
\Zend\Http\Header\Cookiearray
int
What value to return
array
string
_matchDomain(string $domain) : array
string
array
_matchPath(array $domains, string $path) : array
array
string
array
$rawCookies : array
COOKIE_OBJECT
COOKIE_STRING_ARRAY
COOKIE_STRING_CONCAT