1 | <?php |
||
30 | class Server implements InternalClientInterface |
||
31 | { |
||
32 | |||
33 | const PROTOCOL = 'http'; |
||
34 | const SQL_PATH = '/_sql'; |
||
35 | |||
36 | /** |
||
37 | * @var HttpClient |
||
38 | */ |
||
39 | private $client; |
||
40 | |||
41 | private $opts = [ |
||
42 | 'headers' => [] |
||
43 | ]; |
||
44 | |||
45 | /** |
||
46 | * @param string $uri |
||
47 | * @param array $options |
||
48 | */ |
||
49 | public function __construct($uri, array $options) |
||
57 | |||
58 | 1 | public function setTimeout($timeout) |
|
62 | |||
63 | public function setHttpBasicAuth($username, $passwd) |
||
67 | |||
68 | 1 | public function setHttpHeader($name, $value) |
|
72 | |||
73 | 1 | public function getServerInfo() |
|
78 | |||
79 | 1 | public function getServerVersion() |
|
84 | |||
85 | /** |
||
86 | * Execute a HTTP/1.1 POST request with JSON body |
||
87 | * |
||
88 | * @param array $body |
||
89 | |||
90 | * @return ResponseInterface |
||
91 | * @throws RequestException When an error is encountered |
||
92 | */ |
||
93 | public function doRequest(array $body) |
||
98 | |||
99 | /** |
||
100 | * Compute a URI for usage with the HTTP client |
||
101 | * |
||
102 | * @param string $server A host:port string |
||
103 | * |
||
104 | * @return string An URI which can be used by the HTTP client |
||
105 | */ |
||
106 | 4 | private static function computeURI($server) |
|
110 | } |
||
111 |