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 {@see DataStream} body.

Public Methods

Hide inherited methods

Method Description Defined By
createResponse() Creates an HTTP response with the given data wrapped in a {@see 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 {@see DataStream}.

public abstract \Psr\Http\Message\ResponseInterface createResponse ( mixed $data null, integer $code Status::OK, string $reasonPhrase '' )
$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 {@see \Yiisoft\DataResponse\DataStream\DataStream} body.

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