Psr7DelegationTrait
Pure one-line delegations to the wrapped Nyholm\Psr7\ServerRequest.
Everything here is mechanical passthrough with no Quiote-specific behavior; methods that need to react to the change (e.g. withUri() re-syncing URL metadata) stay on WebRequest itself.
Synopsis
Section titled “Synopsis”trait Psr7DelegationTrait
| Source | Request/Psr7DelegationTrait.php |
Methods
Section titled “Methods”| Method | Description |
|---|---|
getAttribute(mixed $name, mixed $default = null): mixed | Returns the named request attribute. |
getAttributes(): array<string, mixed> | |
getBody(): StreamInterface | Returns the wrapped request’s body stream. |
getCookieParams(): array<string, mixed> | |
getHeader(mixed $name): array | Returns every value of the named header, one entry per value. |
getHeaderLine(mixed $name): string | Returns the named header’s values joined with commas. |
getHeaders(): array<string, mixed> | |
getMethod(): string | Returns the HTTP method of the wrapped request, in the case it was received in. |
| [`getParsedBody(): array<string, mixed> | object |
getProtocolVersion(): string | Returns the HTTP protocol version of the wrapped PSR-7 request, e.g. |
getQueryParams(): array<string, mixed> | |
getRequestTarget(): string | Returns the request target as it appears on the request line. |
getServerParams(): array<string, mixed> | |
| [`getUploadedFiles(): array<string, UploadedFileInterface | array<int |
getUri(): UriInterface | Returns the wrapped request’s URI. |
hasHeader(mixed $name): bool | Reports whether the wrapped request carries the named header, case-insensitively. |
withAddedHeader(mixed $name, mixed $value): static | Returns a clone with the given value appended to the named header. |
withAttribute(mixed $name, mixed $value): static | Returns a clone carrying the named request attribute. |
withBody(StreamInterface $body): static | Returns a clone whose body is the given stream. |
withCookieParams(array<string, mixed> $cookies): static | |
withHeader(mixed $name, mixed $value): static | Returns a clone with the named header replaced by the given value. |
withMethod(mixed $method): static | Returns a clone using the given HTTP method. |
| [`withParsedBody(array<string, mixed> | object |
withProtocolVersion(mixed $version): static | Returns a clone carrying the given HTTP protocol version. |
withQueryParams(array<string, mixed> $query): static | |
withRequestTarget(mixed $requestTarget): static | Returns a clone whose request line carries the given target verbatim. |
| [`withUploadedFiles(array<string, UploadedFileInterface | array<int |
withoutAttribute(mixed $name): static | Returns a clone with the named request attribute removed. |
withoutHeader(mixed $name): static | Returns a clone with the named header removed. |
getAttribute()
Section titled “getAttribute()”public function getAttribute(mixed $name, mixed $default = null): mixed
Returns the named request attribute.
$default is returned when no attribute of that name has been set, which is how attributes put on the request by middleware are read without knowing whether that middleware ran.
| Parameter | Type | Description |
|---|---|---|
$name | mixed | |
$default | mixed |
Returns mixed
getAttributes()
Section titled “getAttributes()”public function getAttributes(): array<string, mixed>
Returns array``<``string``, ``mixed``>
getBody()
Section titled “getBody()”public function getBody(): StreamInterface
Returns the wrapped request’s body stream.
The live stream, not a copy: reading from it advances the position seen by every other holder of this request.
Returns StreamInterface
getCookieParams()
Section titled “getCookieParams()”public function getCookieParams(): array<string, mixed>
Returns array``<``string``, ``mixed``>
getHeader()
Section titled “getHeader()”public function getHeader(mixed $name): array
Returns every value of the named header, one entry per value.
An empty array when the header is not present, per PSR-7.
| Parameter | Type | Description |
|---|---|---|
$name | mixed |
Returns array
getHeaderLine()
Section titled “getHeaderLine()”public function getHeaderLine(mixed $name): string
Returns the named header’s values joined with commas.
An empty string when the header is not present, per PSR-7.
| Parameter | Type | Description |
|---|---|---|
$name | mixed |
Returns string
getHeaders()
Section titled “getHeaders()”public function getHeaders(): array<string, mixed>
Returns array``<``string``, ``mixed``>
getMethod()
Section titled “getMethod()”public function getMethod(): string
Returns the HTTP method of the wrapped request, in the case it was received in.
Returns string
getParsedBody()
Section titled “getParsedBody()”public function getParsedBody(): array<string, mixed>|object|null
Returns array``<``string``, ``mixed``>``|``object``|``null
getProtocolVersion()
Section titled “getProtocolVersion()”public function getProtocolVersion(): string
Returns the HTTP protocol version of the wrapped PSR-7 request, e.g.
1.1.
Returns string
getQueryParams()
Section titled “getQueryParams()”public function getQueryParams(): array<string, mixed>
Returns array``<``string``, ``mixed``>
getRequestTarget()
Section titled “getRequestTarget()”public function getRequestTarget(): string
Returns the request target as it appears on the request line.
The explicitly set target when there is one, otherwise the origin-form target derived from the URI, per PSR-7.
Returns string
getServerParams()
Section titled “getServerParams()”public function getServerParams(): array<string, mixed>
Returns array``<``string``, ``mixed``>
getUploadedFiles()
Section titled “getUploadedFiles()”public function getUploadedFiles(): array<string, UploadedFileInterface|array<int|string, mixed>>
Returns array``<``string``, UploadedFileInterface|``array``<``int``|``string``, ``mixed``>``>
getUri()
Section titled “getUri()”public function getUri(): UriInterface
Returns the wrapped request’s URI.
Returns UriInterface
hasHeader()
Section titled “hasHeader()”public function hasHeader(mixed $name): bool
Reports whether the wrapped request carries the named header, case-insensitively.
| Parameter | Type | Description |
|---|---|---|
$name | mixed |
Returns bool
withAddedHeader()
Section titled “withAddedHeader()”public function withAddedHeader(mixed $name, mixed $value): static
Returns a clone with the given value appended to the named header.
Existing values of that header are kept. This request is left untouched and the clone starts with an empty parameter cache.
| Parameter | Type | Description |
|---|---|---|
$name | mixed | |
$value | mixed |
Returns static
withAttribute()
Section titled “withAttribute()”public function withAttribute(mixed $name, mixed $value): static
Returns a clone carrying the named request attribute.
This request is left untouched, so middleware wanting the attribute to be visible downstream has to pass the returned instance on.
| Parameter | Type | Description |
|---|---|---|
$name | mixed | |
$value | mixed |
Returns static
withBody()
Section titled “withBody()”public function withBody(StreamInterface $body): static
Returns a clone whose body is the given stream.
This request is left untouched; the clone starts with an empty parameter cache, so parameters are re-derived from the new body.
| Parameter | Type | Description |
|---|---|---|
$body | StreamInterface |
Returns static
withCookieParams()
Section titled “withCookieParams()”public function withCookieParams(array<string, mixed> $cookies): static
| Parameter | Type | Description |
|---|---|---|
$cookies | array``<``string``, ``mixed``> |
Returns static
withHeader()
Section titled “withHeader()”public function withHeader(mixed $name, mixed $value): static
Returns a clone with the named header replaced by the given value.
Any existing values of that header are discarded. This request is left untouched and the clone starts with an empty parameter cache.
| Parameter | Type | Description |
|---|---|---|
$name | mixed | |
$value | mixed |
Returns static
withMethod()
Section titled “withMethod()”public function withMethod(mixed $method): static
Returns a clone using the given HTTP method.
The method is passed through as given; the wrapped PSR-7 request rejects a syntactically invalid one.
| Parameter | Type | Description |
|---|---|---|
$method | mixed |
Returns static
withParsedBody()
Section titled “withParsedBody()”public function withParsedBody(array<string, mixed>|object|null $data): static
| Parameter | Type | Description |
|---|---|---|
$data | `array<string, mixed> | object |
Returns static
withProtocolVersion()
Section titled “withProtocolVersion()”public function withProtocolVersion(mixed $version): static
Returns a clone carrying the given HTTP protocol version.
This request is left untouched; the clone wraps a new PSR-7 request and starts with an empty parameter cache.
| Parameter | Type | Description |
|---|---|---|
$version | mixed |
Returns static
withQueryParams()
Section titled “withQueryParams()”public function withQueryParams(array<string, mixed> $query): static
| Parameter | Type | Description |
|---|---|---|
$query | array``<``string``, ``mixed``> |
Returns static
withRequestTarget()
Section titled “withRequestTarget()”public function withRequestTarget(mixed $requestTarget): static
Returns a clone whose request line carries the given target verbatim.
The URI is not touched, so the target may diverge from it.
| Parameter | Type | Description |
|---|---|---|
$requestTarget | mixed |
Returns static
withUploadedFiles()
Section titled “withUploadedFiles()”public function withUploadedFiles(array<string, UploadedFileInterface|array<int|string, mixed>> $uploadedFiles): static
| Parameter | Type | Description |
|---|---|---|
$uploadedFiles | array``<``string``, UploadedFileInterface` | array<int |
Returns static
withoutAttribute()
Section titled “withoutAttribute()”public function withoutAttribute(mixed $name): static
Returns a clone with the named request attribute removed.
A no-op clone when no attribute of that name is set.
| Parameter | Type | Description |
|---|---|---|
$name | mixed |
Returns static
withoutHeader()
Section titled “withoutHeader()”public function withoutHeader(mixed $name): static
Returns a clone with the named header removed.
Each call clones the whole wrapped request; use the private bulk counterpart when removing several headers at once.
| Parameter | Type | Description |
|---|---|---|
$name | mixed |
Returns static