public function copy($srcID, $dstID, $dstRev = null) {
    if(!$this->db) {
      throw new SagException('No database specified');
    }

    if(empty($srcID) || !is_string($srcID)) {
      throw new SagException('copy() got an invalid source ID');
    }

    if(empty($dstID) || !is_string($dstID)) {
      throw new SagException('copy() got an invalid destination ID');
    }

    if($dstRev != null && (empty($dstRev) || !is_string($dstRev))) {
      throw new SagException('copy() got an invalid source revision');
    }

    $headers = array(
      "Destination" => "$dstID".(($dstRev) ? "?rev=$dstRev" : "")
    );

    $srcID = urlencode($srcID);
    $response = $this->procPacket('COPY', "/{$this->db}/$srcID", null, $headers);

    return $response;
  }
public function copy($srcID, $dstID, $dstRev = null) {
    if(!$this->db) {
      throw new SagException('No database specified');
    }

    if(empty($srcID) || !is_string($srcID)) {
      throw new SagException('copy() got an invalid source ID');
    }

    if(empty($dstID) || !is_string($dstID)) {
      throw new SagException('copy() got an invalid destination ID');
    }

    if($dstRev != null && (empty($dstRev) || !is_string($dstRev))) {
      throw new SagException('copy() got an invalid source revision');
    }

    $headers = array(
      "Destination" => "$dstID".(($dstRev) ? "?rev=$dstRev" : "")
    );

    $srcID = urlencode($srcID);
    $response = $this->procPacket('COPY', "/{$this->db}/$srcID", null, $headers);

    return $response;
  }
public function copy ( $ srcID , $ dstID , $ dstRev = null ) { if ( ! $ this -> db ) { throw new SagException ( 'No database specified' ) ; } if ( empty ( $ srcID ) || ! is_string ( $ srcID ) ) { throw new SagException ( 'copy() got an invalid source ID' ) ; } if ( empty ( $ dstID ) || ! is_string ( $ dstID ) ) { throw new SagException ( 'copy() got an invalid destination ID' ) ; } if ( $ dstRev != null && ( empty ( $ dstRev ) || ! is_string ( $ dstRev ) ) ) { throw new SagException ( 'copy() got an invalid source revision' ) ; } $ headers = array ( "Destination" => "$dstID" . ( ( $ dstRev ) ? "?rev=$dstRev" : "" ) ) ; $ srcID = urlencode ( $ srcID ) ; $ response = $ this -> procPacket ( 'COPY' , "/{$this->db}/$srcID" , null , $ headers ) ; return $ response ; }
COPY's the document.

If you are using a SagCache and are copying to an existing destination,
then the result will be cached (ie., what's copied to the /$destID URL).

@param string The _id of the document you're copying.
@param string The _id of the document you're copying to.
@param string The _rev of the document you're copying to. Defaults to
null.

@return mixed
COPY s the document .