You are here

public function ResourceResponse::__construct in Drupal 9

Same name in this branch
  1. 9 core/modules/jsonapi/src/ResourceResponse.php \Drupal\jsonapi\ResourceResponse::__construct()
  2. 9 core/modules/rest/src/ResourceResponse.php \Drupal\rest\ResourceResponse::__construct()
Same name and namespace in other branches
  1. 8 core/modules/jsonapi/src/ResourceResponse.php \Drupal\jsonapi\ResourceResponse::__construct()

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.

File

core/modules/jsonapi/src/ResourceResponse.php, line 42

Class

ResourceResponse
Contains data for serialization before sending the response.

Namespace

Drupal\jsonapi

Code

public function __construct($data = NULL, $status = 200, array $headers = []) {
  $this->responseData = $data;
  parent::__construct('', $status, $headers);
}