From 9703ee3cdd71454936c647ef292066d8a2597993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20HULARD?= Date: Sat, 27 Feb 2016 20:31:32 +0100 Subject: [PATCH] Remove a direct client call, use API `get` method. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/Api.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Api.php b/src/Api.php index 2084f84..3752146 100644 --- a/src/Api.php +++ b/src/Api.php @@ -165,8 +165,13 @@ class Api private function calculateTimeDelta() { if (!isset($this->time_delta)) { - $response = $this->http_client->get($this->endpoint . "/auth/time"); - $serverTimestamp = (int)(String)$response->getBody(); + $response = $this->rawCall( + 'GET', + "/auth/time", + null, + false + ); + $serverTimestamp = (int)(string)$response->getBody(); $this->time_delta = $serverTimestamp - (int)\time(); }