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 mixed __construct ( \Psr\Http\Message\ResponseInterface $response )
$response \Psr\Http\Message\ResponseInterface

                public function __construct(private ResponseInterface $response)
{
}

            
getBody() public method

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

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

            
getContent() public method

public string getContent ( )

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

            
getContentAsJson() public method

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

            
getHeader() public method

public array getHeader ( mixed $name )
$name mixed

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

            
getHeaderLine() public method

public string getHeaderLine ( mixed $name )
$name mixed

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

            
getHeaders() public method

public array getHeaders ( )

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

            
getProtocolVersion() public method

public string getProtocolVersion ( )

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

            
getReasonPhrase() public method

public string getReasonPhrase ( )

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

            
getResponse() public method

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

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

            
getStatusCode() public method

public integer getStatusCode ( )

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

            
hasHeader() public method

public boolean hasHeader ( mixed $name )
$name mixed

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

            
withAddedHeader() public method

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

            
withBody() public method

public self withBody ( \Psr\Http\Message\StreamInterface $body )
$body \Psr\Http\Message\StreamInterface

                public function withBody(StreamInterface $body): self
{
    return $this->withResponse(
        $this->response->withBody($body)
    );
}

            
withHeader() public method

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

            
withProtocolVersion() public method

public self withProtocolVersion ( string $version )
$version string

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

            
withStatus() public method

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

            
withoutHeader() public method

public self withoutHeader ( string $name )
$name string

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