| Conditions | 3 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 49 | protected function response($content, int $code = 200, array $headers = []): ResponseInterface |
||
| 50 | { |
||
| 51 | $response = $this->getContainer()->getResponse()->withStatus($code); |
||
| 52 | |||
| 53 | if ($content) { |
||
| 54 | $headers['Content-Length'] = strlen($content); |
||
| 55 | $response->getBody()->write($content); |
||
| 56 | } |
||
| 57 | |||
| 58 | foreach ($headers as $k => $v) { |
||
| 59 | $response = $response->withHeader(strtolower($k), $v); |
||
| 60 | } |
||
| 61 | |||
| 62 | return $response; |
||
| 63 | } |
||
| 64 | } |
||
| 65 |