Methods |
public
|
__construct(Arrayable<string, string[]|string>|iterable<string, string[]|string> $items = [])
|
#
|
public
|
addLine(string $line): static
Parse and apply a header field line or continuation thereof
Parse and apply a header field line or continuation thereof
To initialise an instance from an HTTP stream or message, call this
method once per field line after the request or status line, including
the CRLF sequence at the end of each line. After receiving an empty line
("\r\n" ), {@see hasEmptyLine()} returns true , and any headers
received via {@see addLine()} are applied as trailers.
Throws
Implemented by
|
#
|
public
|
hasEmptyLine(): bool
Check if an empty line has been received via addLine()
Check if an empty line has been received via addLine()
Implemented by
|
#
|
public
|
hasBadWhitespace(): bool
Check if a line with bad whitespace has been received via addLine()
Check if a line with bad whitespace has been received via addLine()
Implemented by
|
#
|
public
|
hasObsoleteLineFolding(): bool
Check if obsolete line folding has been received via addLine()
Check if obsolete line folding has been received via addLine()
Implemented by
|
#
|
public
|
addValue(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 $preserveValues = false)
Merge the collection with the given headers, optionally preserving any
existing values
Merge the collection with the given headers, optionally preserving any
existing values
|
#
|
public
|
authorize(CredentialInterface $credential, string $headerName = HeadersInterface::HEADER_AUTHORIZATION): static
Apply a credential to a header
Apply a credential to a header
Implemented by
|
#
|
public
|
normalise(): static
Move the "Host" header to the start of the collection if present
Move the "Host" header to the start of the collection if present
Implemented by
|
#
|
public
|
trailers(): static
Reduce the collection to headers received after the message body
Reduce the collection to headers received after the message body
Implemented by
|
#
|
public
|
withoutTrailers(): static
Reduce the collection to headers received before the message body
Reduce the collection to headers received before the 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 field
lines, preserving the original case of each…
Get header names and values in their original order as a list of field
lines, preserving the original case of each header
If $emptyFormat is given, it is used for headers with an empty 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
|
#
|