Final Class Yiisoft\DataResponse\DataResponseFactory
| Inheritance | Yiisoft\ |
|---|---|
| Implements | Yiisoft\ |
| Deprecated since version | Use {@see \ |
DataResponseFactory creates an instance of the data response {@see DataResponse}.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
|
| createResponse() | Yiisoft\ |
Method Details
| public mixed __construct ( \ | ||
| $responseFactory | \ |
|
| $streamFactory | \ |
|
public function __construct(
private ResponseFactoryInterface $responseFactory,
private StreamFactoryInterface $streamFactory,
) {}
| public Yiisoft\ | ||
| $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);
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.