Total Complexity | 4 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
22 | class StreamFactory implements StreamFactoryInterface |
||
23 | { |
||
24 | /** |
||
25 | * @inheritDoc |
||
26 | */ |
||
27 | 8 | public function createStream(string $content = ''): StreamInterface |
|
28 | { |
||
29 | 8 | $stream = new PhpTempStream(); |
|
30 | 8 | if ($content === '') { |
|
31 | 1 | return $stream; |
|
32 | } |
||
33 | |||
34 | 7 | $stream->write($content); |
|
35 | 7 | $stream->rewind(); |
|
36 | |||
37 | 7 | return $stream; |
|
38 | } |
||
39 | |||
40 | /** |
||
41 | * @inheritDoc |
||
42 | */ |
||
43 | 3 | public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface |
|
46 | } |
||
47 | |||
48 | /** |
||
49 | * @inheritDoc |
||
50 | */ |
||
51 | 2 | public function createStreamFromResource($resource): StreamInterface |
|
56 |