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_CaseInsensitiveDictionary
Associative array of attribute data
__toString()
Attributes and other data can be accessed via methods.
domain_matches(string $string) : boolean
string
Domain to check
boolean
Whether the cookie is valid for the given domainformatForHeader() : string
codeCoverageIgnore | |
---|---|
deprecated | Use {@see Requests_Cookie::format_for_header} |
string
formatForSetCookie() : string
codeCoverageIgnore | |
---|---|
deprecated | Use {@see Requests_Cookie::format_for_set_cookie} |
string
format_for_header() : string
This is used when sending cookies to a server.
string
Cookie formatted for Cookie headeris_expired() : boolean
Checks the age against $this->reference_time to determine if the cookie is expired.
boolean
True if expired, false if time is valid.normalize() : boolean
boolean
Whether 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.
string
Cookie header value (from a Set-Cookie header)
\Requests_Cookie
Parsed cookie objectparseFromHeaders(\Requests_Response_Headers $headers) : string
codeCoverageIgnore | |
---|---|
deprecated | Use {@see Requests_Cookie::parse_from_headers} |
string
parse_from_headers(\Requests_Response_Headers $headers, \Requests_IRI|null $origin= null
, integer|null $time= null
) : array
\Requests_Response_Headers
Headers to parse from
\Requests_IRI
null
URI for comparing cookie origins
integer
null
Reference time for expiration calculation
array
path_matches(string $request_path) : boolean
From the path-match check in RFC 6265 section 5.1.4
string
Path to check
boolean
Whether the cookie is valid for the given pathuri_matches(\Requests_IRI $uri) : boolean
\Requests_IRI
URI to check
boolean
Whether the cookie is valid for the given URInormalize_attribute(string $name, string|boolean $value) : mixed
Handles parsing individual attributes from the cookie values.
string
Attribute name
string
boolean
Attribute value (string value, or true if empty/flag)
mixed
Value 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
0
This is used in place of time()
when calculating Max-Age expiration and
checking time validity.
$value : string