Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / rest / src / ResourceResponse.php
1 <?php
2
3 namespace Drupal\rest;
4
5 use Drupal\Core\Cache\CacheableResponseInterface;
6 use Drupal\Core\Cache\CacheableResponseTrait;
7 use Symfony\Component\HttpFoundation\Response;
8
9 /**
10  * Contains data for serialization before sending the response.
11  *
12  * We do not want to abuse the $content property on the Response class to store
13  * our response data. $content implies that the provided data must either be a
14  * string or an object with a __toString() method, which is not a requirement
15  * for data used here.
16  *
17  * @see \Drupal\rest\ModifiedResourceResponse
18  */
19 class ResourceResponse extends Response implements CacheableResponseInterface, ResourceResponseInterface {
20
21   use CacheableResponseTrait;
22   use ResourceResponseTrait;
23
24   /**
25    * Constructor for ResourceResponse objects.
26    *
27    * @param mixed $data
28    *   Response data that should be serialized.
29    * @param int $status
30    *   The response status code.
31    * @param array $headers
32    *   An array of response headers.
33    */
34   public function __construct($data = NULL, $status = 200, $headers = []) {
35     $this->responseData = $data;
36     parent::__construct('', $status, $headers);
37   }
38
39 }