Mercurial > hg > isophonics-drupal-site
comparison core/modules/rest/src/ResourceResponse.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
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 } |