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