Final Class Yiisoft\Yii\Testing\ResponseAccessor
| Inheritance | Yiisoft\Yii\Testing\ResponseAccessor |
|---|---|
| Implements | Psr\Http\Message\ResponseInterface |
Public Methods
Method Details
| public __construct( \Psr\Http\Message\ResponseInterface $response ): mixed | ||
| $response | \Psr\Http\Message\ResponseInterface | |
public function __construct(private ResponseInterface $response)
{
}
| public getBody( ): \Psr\Http\Message\StreamInterface |
public function getBody(): StreamInterface
{
return $this->response->getBody();
}
| public getContent( ): string |
public function getContent(): string
{
$stream = $this->response->getBody();
$stream->rewind();
return $stream->getContents();
}
| public getContentAsJson( integer $flags = JSON_OBJECT_AS_ARRAY | JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE ): mixed | ||
| $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 getHeader( mixed $name ): array | ||
| $name | mixed | |
public function getHeader($name): array
{
return $this->response->getHeader($name);
}
| public getHeaderLine( mixed $name ): string | ||
| $name | mixed | |
public function getHeaderLine($name): string
{
return $this->response->getHeaderLine($name);
}
| public getHeaders( ): array |
public function getHeaders(): array
{
return $this->response->getHeaders();
}
| public getProtocolVersion( ): string |
public function getProtocolVersion(): string
{
return $this->response->getProtocolVersion();
}
| public getReasonPhrase( ): string |
public function getReasonPhrase(): string
{
return $this->response->getReasonPhrase();
}
| public getResponse( ): \Psr\Http\Message\ResponseInterface |
public function getResponse(): ResponseInterface
{
return $this->response;
}
| public getStatusCode( ): integer |
public function getStatusCode(): int
{
return $this->response->getStatusCode();
}
| public hasHeader( mixed $name ): boolean | ||
| $name | mixed | |
public function hasHeader($name): bool
{
return $this->response->hasHeader($name);
}
| public withAddedHeader( string $name, string|string[] $value ): self | ||
| $name | string | |
| $value | string|string[] | |
public function withAddedHeader($name, $value): self
{
return $this->withResponse(
$this->response->withAddedHeader($name, $value)
);
}
| public withBody( \Psr\Http\Message\StreamInterface $body ): self | ||
| $body | \Psr\Http\Message\StreamInterface | |
public function withBody(StreamInterface $body): self
{
return $this->withResponse(
$this->response->withBody($body)
);
}
| public withHeader( string $name, string|string[] $value ): self | ||
| $name | string | |
| $value | string|string[] | |
public function withHeader($name, $value): self
{
return $this->withResponse(
$this->response->withHeader($name, $value)
);
}
| public withProtocolVersion( string $version ): self | ||
| $version | string | |
public function withProtocolVersion($version): self
{
return $this->withResponse(
$this->response->withProtocolVersion($version)
);
}
| public withStatus( integer $code, string $reasonPhrase = '' ): self | ||
| $code | integer | |
| $reasonPhrase | string | |
public function withStatus($code, $reasonPhrase = ''): self
{
return $this->withResponse(
$this->response->withStatus($code, $reasonPhrase)
);
}
| public withoutHeader( string $name ): self | ||
| $name | string | |
public function withoutHeader($name): self
{
return $this->withResponse(
$this->response->withoutHeader($name)
);
}
Signup or Login in order to comment.