public static function fillBuffer(StreamInterface $stream, $bufferSize = 8192)
	{
		if(!$stream->isReadable())
		{
			throw new \InvalidArgumentException(sprintf('Stream is not readable: %s', get_class($stream)));
		}
		
		$buffer = '';
		
		while(!$stream->eof() && strlen($buffer) < $bufferSize)
		{
			$buffer .= $stream->read($bufferSize - strlen($buffer));
		}
		
		return $buffer;
	}
public static function fillBuffer(StreamInterface $stream, $bufferSize = 8192)
	{
		if(!$stream->isReadable())
		{
			throw new \InvalidArgumentException(sprintf('Stream is not readable: %s', get_class($stream)));
		}
		
		$buffer = '';
		
		while(!$stream->eof() && strlen($buffer) < $bufferSize)
		{
			$buffer .= $stream->read($bufferSize - strlen($buffer));
		}
		
		return $buffer;
	}
public static function fillBuffer ( StreamInterface $ stream , $ bufferSize = 8192 ) { if ( ! $ stream -> isReadable ( ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Stream is not readable: %s' , get_class ( $ stream ) ) ) ; } $ buffer = '' ; while ( ! $ stream -> eof ( ) && strlen ( $ buffer ) < $ bufferSize ) { $ buffer .= $ stream -> read ( $ bufferSize - strlen ( $ buffer ) ) ; } return $ buffer ; }
Read contents from the given input stream until EOF or the specified buffer is full.

@param StreamInterface $stream
@param int $bufferSize
@return string

@throws \InvalidArgumentException When the stream is not readable.
Read contents from the given input stream until EOF or the specified buffer is full .