Trait implementing functionality common to requests and responses.
- Full name:
\GuzzleHttp\Psr7\MessageTrait
private array<string,string[]> $headers
private array<string,string> $headerNames
private string $protocol
private \Psr\Http\Message\StreamInterface|null $stream
public getProtocolVersion(): string
public withProtocolVersion(mixed $version): \Psr\Http\Message\MessageInterface
Parameters:
Parameter | Type | Description |
---|---|---|
$version |
mixed |
public getHeaders(): array
public hasHeader(mixed $header): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$header |
mixed |
public getHeader(mixed $header): array
Parameters:
Parameter | Type | Description |
---|---|---|
$header |
mixed |
public getHeaderLine(mixed $header): string
Parameters:
Parameter | Type | Description |
---|---|---|
$header |
mixed |
public withHeader(mixed $header, mixed $value): \Psr\Http\Message\MessageInterface
Parameters:
Parameter | Type | Description |
---|---|---|
$header |
mixed | |
$value |
mixed |
public withAddedHeader(mixed $header, mixed $value): \Psr\Http\Message\MessageInterface
Parameters:
Parameter | Type | Description |
---|---|---|
$header |
mixed | |
$value |
mixed |
public withoutHeader(mixed $header): \Psr\Http\Message\MessageInterface
Parameters:
Parameter | Type | Description |
---|---|---|
$header |
mixed |
public getBody(): \Psr\Http\Message\StreamInterface
public withBody(\Psr\Http\Message\StreamInterface $body): \Psr\Http\Message\MessageInterface
Parameters:
Parameter | Type | Description |
---|---|---|
$body |
\Psr\Http\Message\StreamInterface |
private setHeaders(array<string|int,string|string[]> $headers): void
Parameters:
Parameter | Type | Description |
---|---|---|
$headers |
array<string|int,string|string[]> |
private normalizeHeaderValue(mixed $value): string[]
Parameters:
Parameter | Type | Description |
---|---|---|
$value |
mixed |
Trims whitespace from the header values.
private trimAndValidateHeaderValues(array $values): string[]
Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field.
header-field = field-name ":" OWS field-value OWS OWS = *( SP / HTAB )
Parameters:
Parameter | Type | Description |
---|---|---|
$values |
array | Header values |
Return Value:
Trimmed header values
See Also:
private assertHeader(mixed $header): void
Parameters:
Parameter | Type | Description |
---|---|---|
$header |
mixed |
See Also:
private assertValue(string $value): void
Parameters:
Parameter | Type | Description |
---|---|---|
$value |
string |
See Also:
- https://tools.ietf.org/html/rfc7230#section-3.2 - field-value = ( field-content / obs-fold ) field-content = field-vchar [ 1( SP / HTAB ) field-vchar ] field-vchar = VCHAR / obs-text VCHAR = %x21-7E obs-text = %x80-FF obs-fold = CRLF 1*( SP / HTAB )