Final Class Yiisoft\Yii\Testing\ResponseAccessor
| Inheritance | Yiisoft\ |
|---|---|
| Implements | Psr\ |
Public Methods
Method Details
| public mixed __construct ( \ | ||
| $response | \ |
|
public function __construct(private ResponseInterface $response) {}
| public \ |
public function getBody(): StreamInterface
{
return $this->response->getBody();
}
| public string getContent ( ) |
public function getContent(): string
{
$stream = $this->response->getBody();
$stream->rewind();
return $stream->getContents();
}
| public mixed getContentAsJson ( integer $flags = JSON_OBJECT_AS_ARRAY | JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE ) | ||
| $flags | integer | |
public function getContentAsJson(
int $flags = JSON_OBJECT_AS_ARRAY | JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE,
): mixed {
return json_decode($this->getContent(), flags: $flags);
}
| public array getHeader ( mixed $name ) | ||
| $name | mixed | |
public function getHeader($name): array
{
return $this->response->getHeader($name);
}
| public string getHeaderLine ( mixed $name ) | ||
| $name | mixed | |
public function getHeaderLine($name): string
{
return $this->response->getHeaderLine($name);
}
| public array getHeaders ( ) |
public function getHeaders(): array
{
return $this->response->getHeaders();
}
| public string getProtocolVersion ( ) |
public function getProtocolVersion(): string
{
return $this->response->getProtocolVersion();
}
| public string getReasonPhrase ( ) |
public function getReasonPhrase(): string
{
return $this->response->getReasonPhrase();
}
| public \ |
public function getResponse(): ResponseInterface
{
return $this->response;
}
| public integer getStatusCode ( ) |
public function getStatusCode(): int
{
return $this->response->getStatusCode();
}
| public boolean hasHeader ( mixed $name ) | ||
| $name | mixed | |
public function hasHeader($name): bool
{
return $this->response->hasHeader($name);
}
| public self withAddedHeader ( string $name, string|string[] $value ) | ||
| $name | string | |
| $value | string|string[] | |
public function withAddedHeader($name, $value): self
{
return $this->withResponse(
$this->response->withAddedHeader($name, $value),
);
}
| public self withBody ( \ | ||
| $body | \ |
|
public function withBody(StreamInterface $body): self
{
return $this->withResponse(
$this->response->withBody($body),
);
}
| public self withHeader ( string $name, string|string[] $value ) | ||
| $name | string | |
| $value | string|string[] | |
public function withHeader($name, $value): self
{
return $this->withResponse(
$this->response->withHeader($name, $value),
);
}
| public self withProtocolVersion ( string $version ) | ||
| $version | string | |
public function withProtocolVersion($version): self
{
return $this->withResponse(
$this->response->withProtocolVersion($version),
);
}
| public self withStatus ( integer $code, string $reasonPhrase = '' ) | ||
| $code | integer | |
| $reasonPhrase | string | |
public function withStatus($code, $reasonPhrase = ''): self
{
return $this->withResponse(
$this->response->withStatus($code, $reasonPhrase),
);
}
| public self withoutHeader ( string $name ) | ||
| $name | string | |
public function withoutHeader($name): self
{
return $this->withResponse(
$this->response->withoutHeader($name),
);
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.