Cookie storage object
| package | Requests |
|---|---|
| subpackage | Cookies |
__construct(string $name, string $value, array|\Requests_Utility_CaseInsensitiveDictionary $attributes= array(), $flags= array(), $reference_time= null)
string
string
array\Requests_Utility_CaseInsensitiveDictionaryAssociative array of attribute data
__toString()
Attributes and other data can be accessed via methods.
domain_matches(string $string) : boolean
stringDomain to check
booleanWhether the cookie is valid for the given domainformatForHeader() : string
| codeCoverageIgnore | |
|---|---|
| deprecated | Use {@see Requests_Cookie::format_for_header} |
stringformatForSetCookie() : string
| codeCoverageIgnore | |
|---|---|
| deprecated | Use {@see Requests_Cookie::format_for_set_cookie} |
stringformat_for_header() : string
This is used when sending cookies to a server.
stringCookie formatted for Cookie headeris_expired() : boolean
Checks the age against $this->reference_time to determine if the cookie is expired.
booleanTrue if expired, false if time is valid.normalize() : boolean
booleanWhether the cookie was successfully normalizedparse(string $string, $name= '', $reference_time= null) : \Requests_Cookie
Based on Mozilla's parsing code in Firefox and related projects, which is an intentional deviation from RFC 2109 and RFC 2616. RFC 6265 specifies some of this handling, but not in a thorough manner.
stringCookie header value (from a Set-Cookie header)
\Requests_CookieParsed cookie objectparseFromHeaders(\Requests_Response_Headers $headers) : string
| codeCoverageIgnore | |
|---|---|
| deprecated | Use {@see Requests_Cookie::parse_from_headers} |
stringparse_from_headers(\Requests_Response_Headers $headers, \Requests_IRI|null $origin= null, integer|null $time= null) : array
\Requests_Response_HeadersHeaders to parse from
\Requests_IRInullURI for comparing cookie origins
integernullReference time for expiration calculation
arraypath_matches(string $request_path) : boolean
From the path-match check in RFC 6265 section 5.1.4
stringPath to check
booleanWhether the cookie is valid for the given pathuri_matches(\Requests_IRI $uri) : boolean
\Requests_IRIURI to check
booleanWhether the cookie is valid for the given URInormalize_attribute(string $name, string|boolean $value) : mixed
Handles parsing individual attributes from the cookie values.
stringAttribute name
stringbooleanAttribute value (string value, or true if empty/flag)
mixedValue if available, or null if the attribute value is invalid (and should be skipped)$attributes : \Requests_Utility_CaseInsensitiveDictionary | array
array()Valid keys are (currently) path, domain, expires, max-age, secure and httponly.
$flags : array
array()Valid keys are (currently) creation, last-access, persistent and host-only.
$name : string
$reference_time : integer
0This is used in place of time() when calculating Max-Age expiration and
checking time validity.
$value : string