Skip to content

Commit 972e2ea

Browse files
committed
Tidy up namespaces
1 parent bf80641 commit 972e2ea

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/PHPCouchDB/Database.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function getAllDocs($options = []) : array
5454
}
5555
return $docs;
5656
} else {
57-
throw new \PHPCouchDB\Exception\ServerException('JSON response not received or not understood');
57+
throw new Exception\ServerException('JSON response not received or not understood');
5858
}
5959
}
6060
}
@@ -71,7 +71,7 @@ public function getAllDocs($options = []) : array
7171
public function create($doc)
7272
{
7373
if (!is_array($doc)) {
74-
throw new \PHPCouchDB\Exception\DatabaseException('A document is required, in array format');
74+
throw new Exception\DatabaseException('A document is required, in array format');
7575
}
7676

7777
// do we have the ID?
@@ -93,10 +93,10 @@ public function create($doc)
9393
$id = $response_data['id'];
9494
// all good. Let's fetch the doc and return it
9595
$fetched_data = json_decode($this->client->get('/' . $this->db_name . '/' . $id)->getBody());
96-
return new \PHPCouchDB\Document($fetched_data);
96+
return new Document($this->client, $this->db_name, $fetched_data);
9797
}
9898
} catch (\GuzzleHttp\Exception\ConnectException $e) {
99-
throw new \PHPCouchDB\Exception\ServerException(
99+
throw new Exception\ServerException(
100100
"Could not create record. Error: " . $e->getMessage(),
101101
0,
102102
$e
@@ -112,7 +112,7 @@ public function create($doc)
112112
* @throws PHPCouchDB\Exception\ServerException if the response can't be understood
113113
* @throws PHPCouchDB\Exception\DatabaseException if the doc isn't found
114114
*/
115-
public function getDocById($id) : \PHPCouchDB\Document
115+
public function getDocById($id) : Document
116116
{
117117
$endpoint = "/" . $this->db_name . "/" . $id;
118118
$response = $this->client->request("GET", $endpoint);
@@ -121,10 +121,10 @@ public function getDocById($id) : \PHPCouchDB\Document
121121
$doc = new Document($this->client, $this->db_name, $data);
122122
return $doc;
123123
} else {
124-
throw new \PHPCouchDB\Exception\ServerException('JSON response not received or not understood');
124+
throw new Exception\ServerException('JSON response not received or not understood');
125125
}
126126
} else {
127-
throw new \PHPCouchDB\Exception\DatabaseException('Document not found');
127+
throw new Exception\DatabaseException('Document not found');
128128
}
129129
}
130130
}

0 commit comments

Comments
 (0)