function ResourceResponse::__construct

Same name in this branch
  1. 11.x core/modules/jsonapi/src/ResourceResponse.php \Drupal\jsonapi\ResourceResponse::__construct()
Same name in other branches
  1. 9 core/modules/jsonapi/src/ResourceResponse.php \Drupal\jsonapi\ResourceResponse::__construct()
  2. 9 core/modules/rest/src/ResourceResponse.php \Drupal\rest\ResourceResponse::__construct()
  3. 8.9.x core/modules/jsonapi/src/ResourceResponse.php \Drupal\jsonapi\ResourceResponse::__construct()
  4. 8.9.x core/modules/rest/src/ResourceResponse.php \Drupal\rest\ResourceResponse::__construct()
  5. 10 core/modules/jsonapi/src/ResourceResponse.php \Drupal\jsonapi\ResourceResponse::__construct()
  6. 10 core/modules/rest/src/ResourceResponse.php \Drupal\rest\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/rest/src/ResourceResponse.php, line 36

Class

ResourceResponse
Contains data for serialization before sending the response.

Namespace

Drupal\rest

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.