Conditions | 1 |
Paths | 1 |
Total Lines | 14 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
30 | public function jsonResponse(Response $response, $statusCode = 200, $data = '') |
||
31 | { |
||
32 | $jsonResponse = $response |
||
33 | ->withHeader('Access-Control-Allow-Origin', '*') |
||
34 | ->withHeader('Access-Control-Allow-Methods', 'GET, PUT, PATCH, POST, DELETE, OPTIONS') |
||
35 | ->withHeader('Access-Control-Allow-Credentials', 'true') |
||
36 | ->withHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization, X-Requested-With') |
||
37 | ->withHeader('Content-Type', 'application/vnd.api+json') |
||
38 | ->withStatus($statusCode); |
||
39 | |||
40 | $jsonResponse->getBody()->write($data); |
||
41 | |||
42 | return $jsonResponse; |
||
43 | } |
||
44 | } |
||
45 |