/** * @param $id * @return Document * @throws CouchDbException */ public function getDocumentById($id) { try { $response = $this->client->get($this->getDocumentUrl($id), 200, $this->server->getOptions()); $document = new Document(); $document->populateFromArray($response); return $document; } catch (CouchDbException $exception) { // If exception was a 404 the document was not found. So we can create one using $id if ($exception->getCode() == 404) { $document = new Document($id); return $document; } else { throw $exception; } } }
/** * @return array */ public function listDbs() { return $this->client->get($this->getServerUrl() . '/_all_dbs', 200, $this->getOptions()); }