|
@@ 62-69 (lines=8) @@
|
| 59 |
|
$this->psrResponseFactory = $psrResponseFactory; |
| 60 |
|
} |
| 61 |
|
|
| 62 |
|
public function respond($content = '', int $status = 200, array $headers = []): ResponseInterface |
| 63 |
|
{ |
| 64 |
|
$response = $this->psrResponseFactory->createResponse(new Response($content, $status, $headers)); |
| 65 |
|
|
| 66 |
|
$response->getBody()->rewind(); |
| 67 |
|
|
| 68 |
|
return $response; |
| 69 |
|
} |
| 70 |
|
|
| 71 |
|
public function respondJson($data = null, int $status = 200, array $headers = []): ResponseInterface |
| 72 |
|
{ |
|
@@ 71-78 (lines=8) @@
|
| 68 |
|
return $response; |
| 69 |
|
} |
| 70 |
|
|
| 71 |
|
public function respondJson($data = null, int $status = 200, array $headers = []): ResponseInterface |
| 72 |
|
{ |
| 73 |
|
$response = $this->psrResponseFactory->createResponse(new JsonResponse($data, $status, $headers)); |
| 74 |
|
|
| 75 |
|
$response->getBody()->rewind(); |
| 76 |
|
|
| 77 |
|
return $response; |
| 78 |
|
} |
| 79 |
|
|
| 80 |
|
/** |
| 81 |
|
* @throws \Exception |