Cookie
class Cookie (View source)
A class representing a list of cookies with specific attributes.
Constants
PARSE_RAW |
Do not decode cookie contents. |
SECURE |
The cookies' flags have the secure attribute set. |
HTTPONLY |
The cookies' flags have the httpOnly attribute set. |
Methods
Create a new cookie list.
String cast handler. Alias of http\Cookie::toString().
(Re)set the cookies.
Retrieve a specific cookie value.
Get the list of cookies.
Retrieve the effective domain of the cookie list.
Get the currently set expires attribute.
Retrieve an extra attribute.
Retrieve the list of extra attributes.
Get the currently set flags.
Get the currently set max-age attribute of the cookie list.
Retrieve the path the cookie(s) of this cookie list are effective at.
(Re)set the cookies.
Set the traditional expires timestamp.
Set the path the cookie(s) of this cookie list should be effective at.
Get the cookie list as array.
Retrieve the string representation of the cookie list.
Details
__construct(mixed $cookies = null, int $flags = 0, array $allowed_extras = null)
Create a new cookie list.
string
__toString()
String cast handler. Alias of http\Cookie::toString().
Cookie
addCookie(string $cookie_name, string $cookie_value)
Add a cookie.
See http\Cookie::setCookie() and http\Cookie::addCookies().
Cookie
addCookies(array $cookies)
(Re)set the cookies.
See http\Cookie::setCookies().
Cookie
addExtra(string $extra_name, string $extra_value)
Add an extra attribute to the cookie list.
See http\Cookie::setExtra().
Cookie
addExtras(array $extras)
Add several extra attributes.
See http\Cookie::addExtra().
string|null
getCookie(string $cookie_name)
Retrieve a specific cookie value.
See http\Cookie::setCookie().
array
getCookies()
Get the list of cookies.
See http\Cookie::setCookies().
string
getDomain()
Retrieve the effective domain of the cookie list.
See http\Cookie::setDomain().
int
getExpires()
Get the currently set expires attribute.
See http\Cookie::setExpires().
NOTE: A return value of -1 means that the attribute is not set.
string
getExtra(string $name)
Retrieve an extra attribute.
See http\Cookie::setExtra().
array
getExtras()
Retrieve the list of extra attributes.
See http\Cookie::setExtras().
int
getFlags()
Get the currently set flags.
See http\Cookie::SECURE and http\Cookie::HTTPONLY constants.
int
getMaxAge()
Get the currently set max-age attribute of the cookie list.
See http\Cookie::setMaxAge().
NOTE: A return value of -1 means that the attribute is not set.
string
getPath()
Retrieve the path the cookie(s) of this cookie list are effective at.
See http\Cookie::setPath().
Cookie
setCookie(string $cookie_name, string $cookie_value)
(Re)set a cookie.
See http\Cookie::addCookie() and http\Cookie::setCookies().
NOTE: The cookie will be deleted from the list if $cookie_value is NULL.
Cookie
setCookies(array $cookies = null)
(Re)set the cookies.
See http\Cookie::addCookies().
Cookie
setDomain(string $value = null)
Set the effective domain of the cookie list.
See http\Cookie::setPath().
Cookie
setExpires(int $value = -1)
Set the traditional expires timestamp.
See http\Cookie::setMaxAge() for a safer alternative.
Cookie
setExtra(string $extra_name, string $extra_value = null)
(Re)set an extra attribute.
See http\Cookie::addExtra().
NOTE: The attribute will be removed from the extras list if $extra_value is NULL.
Cookie
setExtras(array $extras = null)
(Re)set the extra attributes.
See http\Cookie::addExtras().
Cookie
setFlags(int $value = 0)
Set the flags to specified $value.
See http\Cookie::SECURE and http\Cookie::HTTPONLY constants.
Cookie
setMaxAge(int $value = -1)
Set the maximum age the cookie may have on the client side.
This is a client clock departure safe alternative to the "expires" attribute. See http\Cookie::setExpires().
Cookie
setPath(string $path = null)
Set the path the cookie(s) of this cookie list should be effective at.
See http\Cookie::setDomain().
array
toArray()
Get the cookie list as array.
string
toString()
Retrieve the string representation of the cookie list.
See http\Cookie::toArray().