| Conditions | 4 |
| Paths | 4 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 19 | public function createStream($body = null) |
||
| 20 | { |
||
| 21 | if (!$body instanceof StreamInterface) { |
||
| 22 | if (is_resource($body)) { |
||
| 23 | $body = new Stream($body); |
||
| 24 | } else { |
||
| 25 | $stream = new Stream('php://memory', 'rw'); |
||
| 26 | |||
| 27 | if (null !== $body) { |
||
| 28 | $stream->write((string) $body); |
||
| 29 | } |
||
| 30 | |||
| 31 | $body = $stream; |
||
| 32 | } |
||
| 33 | } |
||
| 34 | |||
| 35 | $body->rewind(); |
||
| 36 | |||
| 37 | return $body; |
||
| 38 | } |
||
| 39 | } |
||
| 40 |