| Conditions | 5 |
| Paths | 5 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 5 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 43 | 4 | private static function createBody($html): StreamInterface |
|
| 44 | { |
||
| 45 | 4 | if ($html instanceof StreamInterface) { |
|
| 46 | 1 | return $html; |
|
| 47 | } |
||
| 48 | |||
| 49 | 3 | if (is_object($html) && method_exists($html, '__toString')) { |
|
| 50 | 1 | $html = (string) $html; |
|
| 51 | } |
||
| 52 | |||
| 53 | 3 | if (!is_string($html)) { |
|
| 54 | 1 | throw new InvalidArgumentException('Unable to create the HTML response due to a unexpected HTML type'); |
|
| 55 | } |
||
| 56 | |||
| 57 | 2 | $stream = new PhpTempStream('r+b'); |
|
| 58 | 2 | $stream->write($html); |
|
| 59 | 2 | $stream->rewind(); |
|
| 60 | |||
| 61 | 2 | return $stream; |
|
| 62 | } |
||
| 64 |