File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace PHPCouchDB ;
4
4
5
- class Server {
5
+ class Server
6
+ {
6
7
protected $ client ;
7
8
8
- public function __construct (\GuzzleHttp \ClientInterface $ client ) {
9
- if ($ client ) {
9
+ public function __construct (\GuzzleHttp \ClientInterface $ client )
10
+ {
11
+ if ($ client ) {
10
12
$ this ->client = $ client ;
11
13
} else {
12
14
throw new Exception ('$client is required ' );
13
15
}
14
16
}
15
17
16
- public function getVersion () {
18
+ public function getVersion ()
19
+ {
17
20
$ response = $ this ->client ->request ("GET " , "/ " );
18
- if ($ response ->getStatusCode () == 200 ) {
21
+ if ($ response ->getStatusCode () == 200 ) {
19
22
// try to decode JSON
20
- if ($ json_data = json_decode ($ response ->getBody (), true )) {
21
- if ($ json_data ['version ' ]) {
23
+ if ($ json_data = json_decode ($ response ->getBody (), true )) {
24
+ if ($ json_data ['version ' ]) {
22
25
return $ json_data ['version ' ];
23
26
} else {
24
27
return "unknown " ;
You can’t perform that action at this time.
0 commit comments