| Conditions | 4 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | public function __construct($content, int $code = Http::CODE_OK, array $config = []) |
||
| 22 | { |
||
| 23 | switch (true) { |
||
| 24 | case is_string($content): |
||
| 25 | // passthrough |
||
| 26 | break; |
||
| 27 | case is_array($content) || $content instanceof \Generator: |
||
| 28 | $content = trim(static::implode_recur("\n", $content), "\n"); |
||
| 29 | break; |
||
| 30 | default: |
||
| 31 | $content = (string) $content; |
||
| 32 | break; |
||
| 33 | } |
||
| 34 | $this->config = $config; |
||
| 35 | $this->message = (new Message()) |
||
| 36 | ->withCode($code) |
||
| 37 | ->withHeaders(['Content-Type' => Http::CONTENT_TEXT]) |
||
| 38 | ->withBody($content) |
||
| 39 | ; |
||
| 65 |