DataResponse
extends Response
in package
A generic DataResponse class that is used to return generic data responses for responders to transform
Tags
Table of Contents
Properties
- $data : T
- response data
Methods
- __construct() : mixed
- getData() : T
- Used to get the set parameters
- setData() : DataResponse
- Sets values in the data json array
Properties
$data
response data
protected
T
$data
Methods
__construct()
public
__construct([T $data = [] ][, S $statusCode = Http::STATUS_OK ][, H $headers = [] ]) : mixed
Parameters
- $data : T = []
-
the object or array that should be transformed
- $statusCode : S = Http::STATUS_OK
-
the Http status code, defaults to 200
- $headers : H = []
-
additional key value based headers
Tags
getData()
Used to get the set parameters
public
getData() : T
Tags
Return values
T —the data
setData()
Sets values in the data json array
public
setData(T $data) : DataResponse
Parameters
- $data : T
-
an array or object which will be transformed
Tags
Return values
DataResponse —Reference to this object