class ResourceResponse extends Response implements CacheableResponseInterface, ResourceResponseInterface (View source)

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.

Traits

Provides an implementation of CacheableResponseInterface.

Properties

protected CacheableMetadata $cacheabilityMetadata

The cacheability metadata.

from  CacheableResponseTrait
protected mixed $responseData

Response data that should be serialized.

from  ResourceResponseTrait

Methods

addCacheableDependency($dependency)

{@inheritdoc}

mixed
getResponseData()

Returns response data that should be serialized.

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

Constructor for ResourceResponse objects.

Details

addCacheableDependency($dependency)

{@inheritdoc}

Parameters

$dependency

getCacheableMetadata()

{@inheritdoc}

mixed getResponseData()

Returns response data that should be serialized.

Return Value

mixed

Response data that should be serialized.

__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.