| Conditions | 4 |
| Paths | 5 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 56 | protected function setHeaders(): void |
||
| 57 | { |
||
| 58 | $h = $this->config['header_func'] ?? 'header'; |
||
| 59 | if (is_callable($h) === false) { |
||
| 60 | throw new \Error("header_func is not callable"); |
||
| 61 | } |
||
| 62 | $code = $this->message->code(); |
||
| 63 | if ($code != Http::CODE_OK) { |
||
| 64 | $msg = Http::httpCodeToMessage($code); |
||
| 65 | $h("HTTP/1.1 {$code} {$msg}"); |
||
| 66 | } |
||
| 67 | |||
| 68 | foreach ($this->message->headers() as $name => $value) { |
||
| 69 | $h("{$name}: $value"); |
||
| 70 | } |
||
| 90 |