| Conditions | 1 |
| Paths | 1 |
| Total Lines | 14 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | public function jsonApiRender(Response $response, $statusCode = 200, $data = '') |
||
| 16 | { |
||
| 17 | $jsonApiResponse = $response |
||
| 18 | ->withHeader('Access-Control-Allow-Origin', '*') |
||
| 19 | ->withHeader('Access-Control-Allow-Methods', 'GET, PUT, PATCH, POST, DELETE, OPTIONS') |
||
| 20 | ->withHeader('Access-Control-Allow-Credentials', 'true') |
||
| 21 | ->withHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization, X-Requested-With') |
||
| 22 | ->withHeader('Content-Type', 'application/vnd.api+json') |
||
| 23 | ->withStatus($statusCode); |
||
| 24 | |||
| 25 | $jsonApiResponse->getBody()->write($data); |
||
| 26 | |||
| 27 | return $jsonApiResponse; |
||
| 28 | } |
||
| 29 | } |