Conditions | 2 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
45 | 2 | public function format($response) |
|
46 | { |
||
47 | 2 | if ($response->data instanceof PayloadInterface) { |
|
48 | 1 | $data = $response->data->toArray(); |
|
49 | } else { |
||
50 | 1 | $data = $response->data; |
|
51 | } |
||
52 | 2 | $response->getHeaders()->set('Content-Type', 'application/json; charset=UTF-8'); |
|
53 | 2 | $response->content = json_encode($data, $this->options); |
|
54 | 2 | } |
|
56 |