Conditions | 5 |
Paths | 2 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
12 | 1 | public function emit(ResponseInterface $res): void |
|
13 | { |
||
14 | 1 | if (! headers_sent()) |
|
15 | { |
||
16 | 1 | foreach ($res->getHeaders() as $name => $values) |
|
17 | { |
||
18 | 1 | foreach ($values as $value) |
|
19 | { |
||
20 | 1 | header($name . ': ' . $value, false); |
|
21 | } |
||
22 | } |
||
23 | |||
24 | 1 | $code = $res->getStatusCode(); |
|
25 | 1 | $text = $res->getReasonPhrase(); |
|
26 | |||
27 | 1 | header('HTTP/' . $res->getProtocolVersion() . ' ' . $code . ($text ? ' ' . $text : ''), true, $code); |
|
28 | } |
||
29 | |||
30 | 1 | echo $res->getBody()->__toString(); |
|
31 | } |
||
32 | } |