[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/Requests/src/ -> Cookie.php (summary)

Cookie storage object

File Size: 533 lines (15 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Cookie:: (12 methods):
  __construct()
  __toString()
  is_expired()
  uri_matches()
  domain_matches()
  path_matches()
  normalize()
  normalize_attribute()
  format_for_header()
  format_for_set_cookie()
  parse()
  parse_from_headers()


Class: Cookie  - X-Ref

Cookie storage object

__construct($name, $value, $attributes = [], $flags = [], $reference_time = null)   X-Ref
Create a new cookie object

param: string                                                  $name           The name of the cookie.
param: string                                                  $value          The value for the cookie.
param: array|\WpOrg\Requests\Utility\CaseInsensitiveDictionary $attributes Associative array of attribute data
param: array                                                   $flags          The flags for the cookie.
param: int|null                                                $reference_time Reference time for relative calculations.

__toString()   X-Ref
Get the cookie value

Attributes and other data can be accessed via methods.

is_expired()   X-Ref
Check if a cookie is expired.

Checks the age against $this->reference_time to determine if the cookie
is expired.

return: boolean True if expired, false if time is valid.

uri_matches(Iri $uri)   X-Ref
Check if a cookie is valid for a given URI

return: boolean Whether the cookie is valid for the given URI
param: \WpOrg\Requests\Iri $uri URI to check

domain_matches($domain)   X-Ref
Check if a cookie is valid for a given domain

return: boolean Whether the cookie is valid for the given domain
param: string $domain Domain to check

path_matches($request_path)   X-Ref
Check if a cookie is valid for a given path

From the path-match check in RFC 6265 section 5.1.4

return: boolean Whether the cookie is valid for the given path
param: string $request_path Path to check

normalize()   X-Ref
Normalize cookie and attributes

return: boolean Whether the cookie was successfully normalized

normalize_attribute($name, $value)   X-Ref
Parse an individual cookie attribute

Handles parsing individual attributes from the cookie values.

return: mixed Value if available, or null if the attribute value is invalid (and should be skipped)
param: string $name Attribute name
param: string|int|bool $value Attribute value (string/integer value, or true if empty/flag)

format_for_header()   X-Ref
Format a cookie for a Cookie header

This is used when sending cookies to a server.

return: string Cookie formatted for Cookie header

format_for_set_cookie()   X-Ref
Format a cookie for a Set-Cookie header

This is used when sending cookies to clients. This isn't really
applicable to client-side usage, but might be handy for debugging.

return: string Cookie formatted for Set-Cookie header

parse($cookie_header, $name = '', $reference_time = null)   X-Ref
Parse a cookie string into a cookie object

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.

return: \WpOrg\Requests\Cookie Parsed cookie object
param: string $cookie_header Cookie header value (from a Set-Cookie header)
param: string $name
param: int|null $reference_time

parse_from_headers(Headers $headers, $origin = null, $time = null)   X-Ref
Parse all Set-Cookie headers from request headers

return: array
param: \WpOrg\Requests\Response\Headers $headers Headers to parse from
param: \WpOrg\Requests\Iri|null $origin URI for comparing cookie origins
param: int|null $time Reference time for expiration calculation



Generated : Sat Dec 21 08:20:01 2024 Cross-referenced by PHPXref