class CacheableResourceResponse extends ResourceResponse implements CacheableResponseInterface (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.
 

Extends ResourceResponse with cacheability.

We want to have the same functionality for both responses that are cacheable and those that are not. This response class should be used in all instances where the response is expected to be cacheable.

Traits

Provides an implementation of CacheableResponseInterface.

Properties

protected mixed $responseData

Response data that should be serialized.

from  ResourceResponse
protected CacheableMetadata $cacheabilityMetadata

The cacheability metadata.

from  CacheableResponseTrait

Methods

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

Constructor for ResourceResponse objects.

mixed
getResponseData()

Returns response data that should be serialized.

addCacheableDependency($dependency)

{@inheritdoc}

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.

addCacheableDependency($dependency)

{@inheritdoc}

Parameters

$dependency

getCacheableMetadata()

{@inheritdoc}