Lines Matching refs:stream
5 * Converts Guzzle streams into PHP stream resources.
13 private $stream;
19 * Returns a resource representing the stream.
21 * @param StreamInterface $stream The stream to get a resource for
24 * @throws \InvalidArgumentException if stream is not readable or writable
26 public static function getResource(StreamInterface $stream)
30 if ($stream->isReadable()) {
31 $mode = $stream->isWritable() ? 'r+' : 'r';
32 } elseif ($stream->isWritable()) {
35 throw new \InvalidArgumentException('The stream must be readable, '
39 return fopen('guzzle://stream', $mode, false, stream_context_create([
40 'guzzle' => ['stream' => $stream],
45 * Registers the stream wrapper if needed
58 if (!isset($options['guzzle']['stream'])) {
63 $this->stream = $options['guzzle']['stream'];
70 return $this->stream->read($count);
75 return (int) $this->stream->write($data);
80 return $this->stream->tell();
85 return $this->stream->eof();
90 return $this->stream->seek($offset, $whence);
109 'size' => $this->stream->getSize() ?: 0,