Methods |
public
|
__construct(Arrayable<string, string[]|string>|iterable<string, string[]|string> $items = [])
|
#
|
public
|
addLine(string $line, bool $strict = false): static
Parse and apply an HTTP header field or continuation thereof
Parse and apply an HTTP header field or continuation thereof
This method should be called once per HTTP header line. Each line must
have a trailing CRLF. If an empty line ("\r\n" ) is given,
{@see HttpHeadersInterface::hasLastLine()} returns true and subsequent
headers applied via {@see HttpHeadersInterface::addLine()} are flagged as
trailers. Methods other than {@see HttpHeadersInterface::trailers()} and
{@see HttpHeadersInterface::withoutTrailers()} make no distinction
between trailers and other headers.
Parameters
$strict |
If true , throw an exception if $line is not
[RFC7230]-compliant.
|
Implemented by
|
#
|
public
|
hasLastLine(): bool
Check if addLine() has received an empty line
Check if addLine() has received an empty line
Implemented by
|
#
|
public
|
add(string $key, string[]|string $value): static
Apply a value to a header, preserving any existing values
Apply a value to a header, preserving any existing values
Implemented by
|
#
|
public
|
set($key, string[]|string $value)
Apply a value to a header, replacing any existing values
Apply a value to a header, replacing any existing values
|
#
|
public
|
unset($key)
Remove a header
|
#
|
public
|
merge(Arrayable<string, string[]|string>|iterable<string, string[]|string> $items, bool $addToExisting = false)
Merge the collection with the given headers, optionally preserving
existing values
Merge the collection with the given headers, optionally preserving
existing values
|
#
|
public
|
authorize(AccessTokenInterface $token, string $headerName = HttpHeader::AUTHORIZATION): static
Apply an access token to the collection
Apply an access token to the collection
Implemented by
|
#
|
public
|
canonicalize(): static
Sort headers in the collection if necessary for compliance with [RFC7230]
Sort headers in the collection if necessary for compliance with [RFC7230]
Implemented by
|
#
|
public
|
trailers(): static
Reduce the collection to headers received after the HTTP message body
Reduce the collection to headers received after the HTTP message body
Implemented by
|
#
|
public
|
withoutTrailers(): static
Reduce the collection to headers received before the HTTP message body
Reduce the collection to headers received before the HTTP message body
Implemented by
|
#
|
public
|
getLines(string $format = '%s: %s', ?string $emptyFormat = null): string[]
Get header names and values in their original order as a list of HTTP
header fields, preserving the original case of…
Get header names and values in their original order as a list of HTTP
header fields, preserving the original case of each header
If $emptyFormat is given, it is used for headers with an empty value.
Implemented by
|
#
|
public
|
getHeaders(): array<string, string[]>
Get an array that maps header names to values, preserving the original
case of the first appearance of each header
Get an array that maps header names to values, preserving the original
case of the first appearance of each header
Implemented by
|
#
|
public
|
getHeaderLines(): array<string, string>
Get an array that maps lowercase header names to comma-separated values
Get an array that maps lowercase header names to comma-separated values
Implemented by
|
#
|
public
|
hasHeader(string $name): bool
True if a header is found in the collection
True if a header is found in the collection
Implemented by
|
#
|
public
|
getHeader(string $name): string[]
Get the value of a header as a list of values
Get the value of a header as a list of values
Implemented by
|
#
|
public
|
getHeaderValues(string $name): string[]
Get the value of a header as a list of values, splitting any
comma-separated values
Get the value of a header as a list of values, splitting any
comma-separated values
Implemented by
|
#
|
public
|
getHeaderLine(string $name): string
Get the comma-separated values of a header
Get the comma-separated values of a header
Implemented by
|
#
|
public
|
getFirstHeaderLine(string $name): string
Get the first value of a header after splitting any comma-separated
values
Get the first value of a header after splitting any comma-separated
values
Implemented by
|
#
|
public
|
getLastHeaderLine(string $name): string
Get the last value of a header after splitting any comma-separated values
Get the last value of a header after splitting any comma-separated values
Implemented by
|
#
|
public
|
getOneHeaderLine(string $name, bool $orSame = false): string
Get the only value of a header after splitting any comma-separated values
Get the only value of a header after splitting any comma-separated values
An exception is thrown if the header has more than one value.
Implemented by
|
#
|
public
|
jsonSerialize(): array<array{name: string, value: string}>
Get header names and values in their original order as a list of HTTP
Archive (HAR) header objects, preserving the…
Get header names and values in their original order as a list of HTTP
Archive (HAR) header objects, preserving the original case of each header
|
#
|