src/Stream.php
public static function reader(StreamInterface $stream, $bufferSize = 8192)
	{
		if(!$stream->isReadable())
		{
			throw new \InvalidArgumentException(sprintf('Stream is not readable: %s', get_class($stream)));
		}
		
		while(!$stream->eof())
		{
			yield $stream->read($bufferSize);
		}
	}
public static function reader(StreamInterface $stream, $bufferSize = 8192)
	{
		if(!$stream->isReadable())
		{
			throw new \InvalidArgumentException(sprintf('Stream is not readable: %s', get_class($stream)));
		}
		
		while(!$stream->eof())
		{
			yield $stream->read($bufferSize);
		}
	}
public static function reader ( StreamInterface $ stream , $ bufferSize = 8192 ) { if ( ! $ stream -> isReadable ( ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Stream is not readable: %s' , get_class ( $ stream ) ) ) ; } while ( ! $ stream -> eof ( ) ) { yield $ stream -> read ( $ bufferSize ) ; } }
Turn a stream into an iterator.

@param StreamInterface $stream
@param int $bufferSize
@return \Iterator

@throws \InvalidArgumentException When the stream is not readable.
Turn a stream into an iterator .