@@ 300-307 (lines=8) @@ | ||
297 | * @param array $data Data to serialize in json |
|
298 | * @param int $statusCode HTTP status code |
|
299 | */ |
|
300 | public function json(array $data, $statusCode = 200) |
|
301 | { |
|
302 | $this->withStatusCode($statusCode); |
|
303 | $this->withContentType('application/json'); |
|
304 | $this->withoutCache(); |
|
305 | $this->withBody(json_encode($data)); |
|
306 | $this->send(); |
|
307 | } |
|
308 | ||
309 | /** |
|
310 | * Send a XML response. |
|
@@ 358-366 (lines=9) @@ | ||
355 | * @param string $data |
|
356 | * @param int $statusCode |
|
357 | */ |
|
358 | public function binary($data, $statusCode = 200) |
|
359 | { |
|
360 | $this->withStatusCode($statusCode); |
|
361 | $this->withoutCache(); |
|
362 | $this->withHeader('Content-Transfer-Encoding', 'binary'); |
|
363 | $this->withContentType('application/octet-stream'); |
|
364 | $this->withBody($data); |
|
365 | $this->send(); |
|
366 | } |
|
367 | ||
368 | /** |
|
369 | * Send a iCal response. |