original_string: public function update($id, array &$doc)
      {
          $json = JSONEncoder::encode($doc);
  
          $response = $this->client->request('PUT', "/{$this->name}/{$id}", [
              'body'    => $json,
              'headers' => ['Content-Type' => 'application/json'],
          ]);
  
          if (201 !== $response->getStatusCode()) {
              throw new Exception('Unable to save document');
          }
  
          $value = JSONEncoder::decode((string) $response->getBody());
  
          $doc['_id'] = $value['id'];
          $doc['_rev'] = $value['rev'];
      }
code: public function update($id, array &$doc)
      {
          $json = JSONEncoder::encode($doc);
  
          $response = $this->client->request('PUT', "/{$this->name}/{$id}", [
              'body'    => $json,
              'headers' => ['Content-Type' => 'application/json'],
          ]);
  
          if (201 !== $response->getStatusCode()) {
              throw new Exception('Unable to save document');
          }
  
          $value = JSONEncoder::decode((string) $response->getBody());
  
          $doc['_id'] = $value['id'];
          $doc['_rev'] = $value['rev'];
      }
code_tokens: public function update ( $ id , array & $ doc ) { $ json = JSONEncoder :: encode ( $ doc ) ; $ response = $ this -> client -> request ( 'PUT' , "/{$this->name}/{$id}" , [ 'body' => $ json , 'headers' => [ 'Content-Type' => 'application/json' ] , ] ) ; if ( 201 !== $ response -> getStatusCode ( ) ) { throw new Exception ( 'Unable to save document' ) ; } $ value = JSONEncoder :: decode ( ( string ) $ response -> getBody ( ) ) ; $ doc [ '_id' ] = $ value [ 'id' ] ; $ doc [ '_rev' ] = $ value [ 'rev' ] ; }
docstring: Updates a document.
  
  @param string $id  The id from the document
  @param array  $doc A reference from the document
  
  @throws Exception
docstring_tokens: Updates a document .