CookieText final class
Minn\Http\CookieText · public/minn/src/Minn/Http/CookieText.php · 133 lines
Set-Cookie text and the matching rules a cookie jar applies: parsing a header into name, value and attributes; normalizing attributes (expires and max-age as timestamps, the domain without its leading dot); whether a cookie belongs to a domain and a path (RFC 6265).
Public
| static | parse(string $header, string $name = ''): array# | A Set-Cookie value split up. With a name given, the first part is all value; a first part without "=" is a value with an empty name. @return array{name: string, value: string, attributes: array<string, string|true>} | ||||||
| static | normalizeAttribute(string $name, mixed $value, int $referenceTime): mixed# | One attribute normalized, or null when it should go: dates become timestamps, the domain loses its leading dot. | ||||||
| static | hostMatches(?string $cookieDomain, string $domain): bool# | Whether a host-only cookie with this domain attribute (none means any) belongs to the domain: the same text only. | ||||||
| static | domainMatches(?string $cookieDomain, string $domain): bool# | Whether a cookie with this domain attribute (none means any) belongs to the domain or one of its subdomains (never an IP address). | ||||||
| static | pathMatches(?string $cookiePath, string $requestPath): bool# | Whether a cookie with this path attribute (none means any) is sent for the request path. | ||||||
| static | defaultPath(string $requestPath): string# | The path a cookie without one gets: the request path up to its last slash, or "/". | ||||||
| static | fields(array|string $data, string $requestedUrl, array $properties): array# | A cookie's fields, as WP_Http_Cookie sets them: from a Set-Cookie value (the value URL-decoded; expires, path, domain and port from its attributes; the domain and path it names none of from the URL it came from: the host, and the URL's directory), or from given fields that are among $properties (an expiry given as a date becomes a timestamp); the path "/" when nothing gives one.
@return array<string, mixed> |
Nothing matches.