1 | <?php |
||
21 | class JsonResponse extends Response |
||
22 | { |
||
23 | /** |
||
24 | * Constructor. |
||
25 | * |
||
26 | * @param array|null $data |
||
27 | * @param int $status |
||
28 | * @param array $headers |
||
29 | */ |
||
30 | public function __construct(array $data = null, $status = 200, array $headers = array()) |
||
38 | |||
39 | /** |
||
40 | * Set and encode array data to json string and set to content. |
||
41 | * |
||
42 | * @param array $data |
||
43 | * |
||
44 | * @return $this |
||
45 | */ |
||
46 | public function setData(array $data) |
||
58 | |||
59 | /** |
||
60 | * {@inheritdoc} |
||
61 | */ |
||
62 | public function setContent($content) |
||
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | protected function computeContent() |
||
82 | } |
||
83 |