Conditions | 1 |
Paths | 1 |
Total Lines | 16 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
51 | public function json() |
||
52 | { |
||
53 | // Define some data. |
||
54 | $data = [ |
||
55 | 'foo' => 'bar', |
||
56 | 'baz' => [ |
||
57 | 'qux' => 'quux', |
||
58 | ] |
||
59 | ]; |
||
60 | |||
61 | // Set the JSON header. |
||
62 | $this->response->headers->set('Content-Type', 'application/json'); |
||
63 | |||
64 | // Encode the data. |
||
65 | $this->response->setContent(json_encode($data)); |
||
66 | } |
||
67 | } |
||
68 |