0 follower

Interface Yiisoft\DataResponse\ResponseFactory\DataResponseFactoryInterface

Implemented byYiisoft\DataResponse\ResponseFactory\AbstractFormattedResponseFactory, Yiisoft\DataResponse\ResponseFactory\DataResponseFactory, Yiisoft\DataResponse\ResponseFactory\FormattedResponseFactory, Yiisoft\DataResponse\ResponseFactory\HtmlResponseFactory, Yiisoft\DataResponse\ResponseFactory\JsonResponseFactory, Yiisoft\DataResponse\ResponseFactory\PlainTextResponseFactory, Yiisoft\DataResponse\ResponseFactory\XmlResponseFactory

Interface for factories that create HTTP responses with Yiisoft\DataResponse\DataStream\DataStream body.

Public Methods

Hide inherited methods

Method Description Defined By
createResponse() Creates an HTTP response with the given data wrapped in a Yiisoft\DataResponse\DataStream\DataStream. Yiisoft\DataResponse\ResponseFactory\DataResponseFactoryInterface

Method Details

Hide inherited methods

createResponse() public abstract method

Creates an HTTP response with the given data wrapped in a Yiisoft\DataResponse\DataStream\DataStream.

public abstract createResponse( mixed $data null, integer $code Status::OK, string $reasonPhrase '' ): \Psr\Http\Message\ResponseInterface
$data mixed

The data to include in the response body.

$code integer

The HTTP status code.

$reasonPhrase string

The reason phrase. If empty, a default phrase for the status code will be used.

return \Psr\Http\Message\ResponseInterface

The created response with Yiisoft\DataResponse\DataStream\DataStream body.

                public function createResponse(
    mixed $data = null,
    int $code = Status::OK,
    string $reasonPhrase = '',
): ResponseInterface;