original_string: public function downloadToStream($id, $destination)
      {
          if ( ! is_resource($destination) || get_resource_type($destination) != "stream") {
              throw InvalidArgumentException::invalidType('$destination', $destination, 'resource');
          }
  
          stream_copy_to_stream($this->openDownloadStream($id), $destination);
      }
code: public function downloadToStream($id, $destination)
      {
          if ( ! is_resource($destination) || get_resource_type($destination) != "stream") {
              throw InvalidArgumentException::invalidType('$destination', $destination, 'resource');
          }
  
          stream_copy_to_stream($this->openDownloadStream($id), $destination);
      }
code_tokens: public function downloadToStream ( $ id , $ destination ) { if ( ! is_resource ( $ destination ) || get_resource_type ( $ destination ) != "stream" ) { throw InvalidArgumentException :: invalidType ( '$destination' , $ destination , 'resource' ) ; } stream_copy_to_stream ( $ this -> openDownloadStream ( $ id ) , $ destination ) ; }
docstring: Writes the contents of a GridFS file to a writable stream.
  
  @param mixed    $id          File ID
  @param resource $destination Writable Stream
  @throws FileNotFoundException if no file could be selected
  @throws InvalidArgumentException if $destination is not a stream
  @throws DriverRuntimeException for other driver errors (e.g. connection errors)
docstring_tokens: Writes the contents of a GridFS file to a writable stream .