Conditions | 4 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
41 | protected function setHeaders(): void |
||
42 | { |
||
43 | $h = $this->config['header_func'] ?? 'header'; |
||
44 | if (is_callable($h) === false) { |
||
45 | throw new \Error("header_func is not callable"); |
||
46 | } |
||
47 | $code = $this->message->code(); |
||
48 | if ($code != Http::CODE_OK) { |
||
49 | $msg = Http::httpCodeToMessage($code); |
||
50 | $h("HTTP/1.1 {$code} {$msg}"); |
||
51 | } |
||
52 | |||
53 | foreach ($this->message->headers() as $name => $value) { |
||
54 | $h("{$name}: $value"); |
||
55 | } |
||
60 |