@@ -30,7 +30,7 @@ class Server
30
30
public function __construct (array $ options )
31
31
{
32
32
if (empty ($ options ) || !is_array ($ options )) {
33
- throw new \ PHPCouchDB \ Exception \ServerException (
33
+ throw new Exception \ServerException (
34
34
'$options is a required parameter, array should contain either a url or a client '
35
35
);
36
36
}
@@ -40,7 +40,7 @@ public function __construct(array $options)
40
40
} elseif (isset ($ options ['url ' ])) {
41
41
$ client = new \GuzzleHttp \Client (["base_uri " => $ options ['url ' ]]);
42
42
} else {
43
- throw new \ PHPCouchDB \ Exception \ServerException (
43
+ throw new Exception \ServerException (
44
44
'Failed to parse $options, array should contain either a url or a client '
45
45
);
46
46
}
@@ -50,7 +50,7 @@ public function __construct(array $options)
50
50
$ client ->get ('/ ' );
51
51
$ this ->client = $ client ;
52
52
} catch (\GuzzleHttp \Exception \ConnectException $ e ) {
53
- throw new \ PHPCouchDB \ Exception \ServerException (
53
+ throw new Exception \ServerException (
54
54
"Could not connect to database. Error: " . $ e ->getMessage (),
55
55
0 ,
56
56
$ e
@@ -76,7 +76,7 @@ public function getVersion() : string
76
76
return "unknown " ;
77
77
}
78
78
} else {
79
- throw new \ PHPCouchDB \ Exception \ServerException ('JSON response not received or not understood ' );
79
+ throw new Exception \ServerException ('JSON response not received or not understood ' );
80
80
}
81
81
}
82
82
}
@@ -95,7 +95,7 @@ public function getAllDbs() : array
95
95
if ($ json_data = json_decode ($ response ->getBody (), true )) {
96
96
return $ json_data ;
97
97
} else {
98
- throw new \ PHPCouchDB \ Exception \ServerException ('JSON response not received or not understood ' );
98
+ throw new Exception \ServerException ('JSON response not received or not understood ' );
99
99
}
100
100
}
101
101
}
@@ -110,11 +110,11 @@ public function getAllDbs() : array
110
110
* with parsing arguments or creating the database object (e.g. database
111
111
* doesn't exist and shouldn't be created)
112
112
*/
113
- public function useDb ($ options ) : \ PHPCouchDB \ Database
113
+ public function useDb ($ options ) : Database
114
114
{
115
115
// check the $options array is sane
116
116
if (!isset ($ options ['name ' ])) {
117
- throw new \ PHPCouchDB \ Exception \ServerException (
117
+ throw new Exception \ServerException (
118
118
'"name" is a required $options parameter '
119
119
);
120
120
} else {
@@ -144,7 +144,7 @@ public function useDb($options) : \PHPCouchDB\Database
144
144
return new Database ($ this ->client , $ db_name );
145
145
}
146
146
147
- throw new \ PHPCouchDB \ Exception \ServerException (
147
+ throw new Exception \ServerException (
148
148
'Database doesn \'t exist, include "create_if_not_exists" parameter to create it '
149
149
);
150
150
}
0 commit comments