src/Stream.php
public static function pipe(StreamInterface $in, StreamInterface $out, $chunkSize = 8192)
	{
		if(!$in->isReadable())
		{
			throw new \InvalidArgumentException(sprintf('Input stream is not readable: %s', get_class($in)));
		}
		
		if(!$out->isWritable())
		{
			throw new \InvalidArgumentException(sprintf('Output stream is not writable: %s', get_class($out)));
		}
		
		$size = 0;
		
		while(!$in->eof())
		{
			$size += $out->write($in->read($chunkSize));
		}
		
		return $size;
	}
public static function pipe(StreamInterface $in, StreamInterface $out, $chunkSize = 8192)
	{
		if(!$in->isReadable())
		{
			throw new \InvalidArgumentException(sprintf('Input stream is not readable: %s', get_class($in)));
		}
		
		if(!$out->isWritable())
		{
			throw new \InvalidArgumentException(sprintf('Output stream is not writable: %s', get_class($out)));
		}
		
		$size = 0;
		
		while(!$in->eof())
		{
			$size += $out->write($in->read($chunkSize));
		}
		
		return $size;
	}
public static function pipe ( StreamInterface $ in , StreamInterface $ out , $ chunkSize = 8192 ) { if ( ! $ in -> isReadable ( ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Input stream is not readable: %s' , get_class ( $ in ) ) ) ; } if ( ! $ out -> isWritable ( ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Output stream is not writable: %s' , get_class ( $ out ) ) ) ; } $ size = 0 ; while ( ! $ in -> eof ( ) ) { $ size += $ out -> write ( $ in -> read ( $ chunkSize ) ) ; } return $ size ; }
Pipe data from an input stream into an output stream.

@param StreamInterface $in
@param StreamInterface $out
@param int $chunkSize Maximum chunk size being used during copy.
@return int Number of bytes being copied.

@throws \InvalidArgumentException When input stream is not readable or output stream is not writable.
Pipe data from an input stream into an output stream .