Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
28 | protected function createStream($value, int $flags = null, int $maxDepth = 512): StreamInterface |
||
29 | { |
||
30 | $flags = $flags ?? (JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_PRESERVE_ZERO_FRACTION); |
||
31 | |||
32 | try { |
||
33 | $value = json_encode($value, $flags | \JSON_THROW_ON_ERROR, $maxDepth); |
||
34 | } catch (\JsonException $e) { |
||
35 | throw new InvalidArgumentException("Invalid value for json encoding: {$e->getMessage()}."); |
||
36 | } |
||
37 | |||
38 | return $this->client->getStreamFactory()->createStream($value); |
||
39 | } |
||
40 | } |
||
41 |