class ResourceResponse extends Response (View source)

internal  JSON:API maintains no PHP API since its API is the HTTP API. This class may change at any time and this will break any dependencies on it.
 

Contains data for serialization before sending the response.

We do not want to abuse the $content property on the Response class to store our response data. $content implies that the provided data must either be a string or an object with a __toString() method, which is not a requirement for data used here.

Properties

protected mixed $responseData

Response data that should be serialized.

Methods

__construct(mixed $data = NULL, int $status = 200, array $headers = [])

Constructor for ResourceResponse objects.

mixed
getResponseData()

Returns response data that should be serialized.

Details

__construct(mixed $data = NULL, int $status = 200, array $headers = [])

Constructor for ResourceResponse objects.

Parameters

mixed $data

Response data that should be serialized.

int $status

The response status code.

array $headers

An array of response headers.

mixed getResponseData()

Returns response data that should be serialized.

Return Value

mixed

Response data that should be serialized.