@@ -28,20 +28,26 @@ class Server
28
28
*/
29
29
public function __construct (array $ options )
30
30
{
31
- if (empty ($ options ) || !is_array ($ options )) {
32
- throw new \PHPCouchDB \Exception \ServerException ('$options is a required parameter, array should contain either a url or a client ' );
31
+ if (empty ($ options ) || !is_array ($ options )) {
32
+ throw new \PHPCouchDB \Exception \ServerException (
33
+ '$options is a required parameter, array should contain either a url or a client '
34
+ );
33
35
}
34
36
35
- if (isset ($ options ['client ' ]) && $ options ['client ' ] instanceof \GuzzleHttp \ClientInterface) {
37
+ if (isset ($ options ['client ' ]) && $ options ['client ' ] instanceof \GuzzleHttp \ClientInterface) {
36
38
$ this ->client = $ options ['client ' ];
37
- } elseif (isset ($ options ['url ' ])) {
39
+ } elseif (isset ($ options ['url ' ])) {
38
40
try {
39
41
$ this ->client = new \GuzzleHttp \Client (["base_uri " => $ options ['url ' ]]);
40
- } catch (Exception $ e ) {
41
- throw new \PHPCouchDB \Exception \ServerException ("Could not connect with URL. Error: " . $ e ->getMessage ());
42
+ } catch (Exception $ e ) {
43
+ throw new \PHPCouchDB \Exception \ServerException (
44
+ "Could not connect with URL. Error: " . $ e ->getMessage ()
45
+ );
42
46
}
43
47
} else {
44
- throw new \PHPCouchDB \Exception \ServerException ('Failed to parse $options, array should contain either a url or a client ' );
48
+ throw new \PHPCouchDB \Exception \ServerException (
49
+ 'Failed to parse $options, array should contain either a url or a client '
50
+ );
45
51
}
46
52
}
47
53
@@ -72,7 +78,8 @@ public function getVersion() : string
72
78
*
73
79
* @return array The database names
74
80
*/
75
- public function getAllDbs () {
81
+ public function getAllDbs ()
82
+ {
76
83
$ response = $ this ->client ->request ("GET " , "/_all_dbs " );
77
84
if ($ response ->getStatusCode () == 200 ) {
78
85
// try to decode JSON
0 commit comments