| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2.0116 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | 32 | public function createStream(string $content = ''): StreamInterface |
|
| 16 | { |
||
| 17 | 32 | $resource = fopen("php://temp", "w+b"); |
|
| 18 | |||
| 19 | 32 | if (!is_resource($resource)) { |
|
| 20 | throw new \InvalidArgumentException('Error while creating PHP stream'); |
||
| 21 | } |
||
| 22 | |||
| 23 | 32 | fwrite($resource, $content); |
|
| 24 | 32 | rewind($resource); |
|
| 25 | |||
| 26 | 32 | return $this->createStreamFromResource($resource); |
|
| 27 | } |
||
| 54 |