| Conditions | 3 |
| Paths | 4 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 34 | public function json(string|array $data, array $headers = []): Response |
||
| 35 | { |
||
| 36 | if (is_array($data)) { |
||
|
|
|||
| 37 | $data = \Safe\json_encode($data); |
||
| 38 | } |
||
| 39 | $this->setContent($data); |
||
| 40 | $this->headers->set('Content-Type', 'application/json'); |
||
| 41 | foreach ($headers as $key => $value) { |
||
| 42 | $this->headers->set($key, $value); |
||
| 43 | } |
||
| 44 | |||
| 45 | return $this; |
||
| 46 | } |
||
| 48 |