1
0
mirror of https://github.com/ovh/php-ovh.git synced 2023-11-05 03:20:26 +01:00

Remove a direct client call, use API get method.

Remove the `$this->http_client->get()` call used in the `calculateTimeDelta` method.
This call is too coupled to the HttpClient, using the same method for all the calls is always better.

Signed-off-by: Stéphane HULARD <s.hulard@chstudio.fr>
This commit is contained in:
Stéphane HULARD 2016-02-27 20:31:32 +01:00
parent 940ec307fb
commit 9703ee3cdd

View File

@ -165,8 +165,13 @@ class Api
private function calculateTimeDelta() private function calculateTimeDelta()
{ {
if (!isset($this->time_delta)) { if (!isset($this->time_delta)) {
$response = $this->http_client->get($this->endpoint . "/auth/time"); $response = $this->rawCall(
$serverTimestamp = (int)(String)$response->getBody(); 'GET',
"/auth/time",
null,
false
);
$serverTimestamp = (int)(string)$response->getBody();
$this->time_delta = $serverTimestamp - (int)\time(); $this->time_delta = $serverTimestamp - (int)\time();
} }