Final Class Yiisoft\DataResponse\DataResponseFactory
| Inheritance | Yiisoft\DataResponse\DataResponseFactory |
|---|---|
| Implements | Yiisoft\DataResponse\DataResponseFactoryInterface |
DataResponseFactory creates an instance of the data response {@see DataResponse}.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\DataResponse\DataResponseFactory | |
| createResponse() | Yiisoft\DataResponse\DataResponseFactory |
Method Details
| public mixed __construct ( \Psr\Http\Message\ResponseFactoryInterface $responseFactory, \Psr\Http\Message\StreamFactoryInterface $streamFactory ) | ||
| $responseFactory | \Psr\Http\Message\ResponseFactoryInterface | |
| $streamFactory | \Psr\Http\Message\StreamFactoryInterface | |
public function __construct(
private ResponseFactoryInterface $responseFactory,
private StreamFactoryInterface $streamFactory,
) {
}
| public Yiisoft\DataResponse\DataResponse createResponse ( mixed $data = null, integer $code = Status::OK, string $reasonPhrase = '' ) | ||
| $data | mixed | |
| $code | integer | |
| $reasonPhrase | string | |
public function createResponse($data = null, int $code = Status::OK, string $reasonPhrase = ''): DataResponse
{
return new DataResponse($data, $code, $reasonPhrase, $this->responseFactory, $this->streamFactory);
}
Signup or Login in order to comment.