0 follower

Final Class Yiisoft\Yii\Testing\ResponseAccessor

InheritanceYiisoft\Yii\Testing\ResponseAccessor
ImplementsPsr\Http\Message\ResponseInterface

Method Details

Hide inherited methods

__construct() public method

public __construct( \Psr\Http\Message\ResponseInterface $response ): mixed
$response \Psr\Http\Message\ResponseInterface

                public function __construct(private ResponseInterface $response)
{
}

            
getBody() public method

public getBody( ): \Psr\Http\Message\StreamInterface

                public function getBody(): StreamInterface
{
    return $this->response->getBody();
}

            
getContent() public method

public getContent( ): string

                public function getContent(): string
{
    $stream = $this->response->getBody();
    $stream->rewind();
    return $stream->getContents();
}

            
getContentAsJson() public method

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);
}

            
getHeader() public method

public getHeader( mixed $name ): array
$name mixed

                public function getHeader($name): array
{
    return $this->response->getHeader($name);
}

            
getHeaderLine() public method

public getHeaderLine( mixed $name ): string
$name mixed

                public function getHeaderLine($name): string
{
    return $this->response->getHeaderLine($name);
}

            
getHeaders() public method

public getHeaders( ): array

                public function getHeaders(): array
{
    return $this->response->getHeaders();
}

            
getProtocolVersion() public method

public getProtocolVersion( ): string

                public function getProtocolVersion(): string
{
    return $this->response->getProtocolVersion();
}

            
getReasonPhrase() public method

public getReasonPhrase( ): string

                public function getReasonPhrase(): string
{
    return $this->response->getReasonPhrase();
}

            
getResponse() public method

public getResponse( ): \Psr\Http\Message\ResponseInterface

                public function getResponse(): ResponseInterface
{
    return $this->response;
}

            
getStatusCode() public method

public getStatusCode( ): integer

                public function getStatusCode(): int
{
    return $this->response->getStatusCode();
}

            
hasHeader() public method

public hasHeader( mixed $name ): boolean
$name mixed

                public function hasHeader($name): bool
{
    return $this->response->hasHeader($name);
}

            
withAddedHeader() public method

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)
    );
}

            
withBody() public method

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)
    );
}

            
withHeader() public method

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)
    );
}

            
withProtocolVersion() public method

public withProtocolVersion( string $version ): self
$version string

                public function withProtocolVersion($version): self
{
    return $this->withResponse(
        $this->response->withProtocolVersion($version)
    );
}

            
withStatus() public method

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)
    );
}

            
withoutHeader() public method

public withoutHeader( string $name ): self
$name string

                public function withoutHeader($name): self
{
    return $this->withResponse(
        $this->response->withoutHeader($name)
    );
}