1 | <?php |
||
31 | class Server implements InternalClientInterface { |
||
32 | |||
33 | const PROTOCOL = 'http'; |
||
34 | const SQL_PATH = '/_sql'; |
||
35 | |||
36 | /** |
||
37 | * @var HttpClient |
||
38 | */ |
||
39 | private $client; |
||
40 | |||
41 | /** |
||
42 | * @param string $uri |
||
43 | * @param array $options |
||
44 | */ |
||
45 | public function __construct($uri, array $options) |
||
50 | |||
51 | 1 | public function setTimeout($timeout) |
|
55 | |||
56 | public function setHttpBasicAuth($username, $passwd) |
||
60 | |||
61 | 1 | public function setHttpHeader($name, $value) |
|
65 | |||
66 | 1 | public function getServerInfo() |
|
71 | |||
72 | 1 | public function getServerVersion() |
|
77 | |||
78 | /** |
||
79 | * Execute a HTTP/1.1 POST request with JSON body |
||
80 | * |
||
81 | * @param array $body |
||
82 | |||
83 | * @return ResponseInterface |
||
84 | * @throws RequestException When an error is encountered |
||
85 | */ |
||
86 | public function doRequest(array $body) |
||
90 | |||
91 | /** |
||
92 | * Compute a URI for usage with the HTTP client |
||
93 | * |
||
94 | * @param string $server A host:port string |
||
95 | * |
||
96 | * @return string An URI which can be used by the HTTP client |
||
97 | */ |
||
98 | 4 | private static function computeURI($server) |
|
102 | } |
||
103 |