Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
36 | protected function createStream($value, int $flags = null, int $maxDepth = 512): StreamInterface |
||
37 | { |
||
38 | $flags = $flags ?? (JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_PRESERVE_ZERO_FRACTION); |
||
39 | |||
40 | try { |
||
41 | $value = json_encode($value, $flags | JSON_THROW_ON_ERROR, $maxDepth); |
||
42 | } catch (JsonException $e) { |
||
43 | throw new InvalidArgumentException("Invalid value for json encoding: {$e->getMessage()}."); |
||
44 | } |
||
45 | |||
46 | return $this->client->getStreamFactory()->createStream($value); |
||
47 | } |
||
48 | } |
||
49 |