From 42dfae706a41ad9d55da99bdba227abdad33bc57 Mon Sep 17 00:00:00 2001 From: Michael Roterman Date: Thu, 27 Mar 2014 00:29:22 +0100 Subject: [PATCH] Improving the way https is enabled. --- lib/Tmdb/Client.php | 4 ++++ lib/Tmdb/HttpClient/HttpClient.php | 10 ++++++++++ lib/Tmdb/HttpClient/HttpClientInterface.php | 3 +++ 3 files changed, 17 insertions(+) diff --git a/lib/Tmdb/Client.php b/lib/Tmdb/Client.php index c0afc7ae..228fe6d2 100644 --- a/lib/Tmdb/Client.php +++ b/lib/Tmdb/Client.php @@ -446,6 +446,10 @@ public function setSecure($secure) { $this->secure = $secure; + if ($this->httpClient instanceof HttpClientInterface) { + $this->getHttpClient()->setBaseUrl($this->getBaseUrl()); + } + return $this; } diff --git a/lib/Tmdb/HttpClient/HttpClient.php b/lib/Tmdb/HttpClient/HttpClient.php index 8618e0c3..09e97ccc 100644 --- a/lib/Tmdb/HttpClient/HttpClient.php +++ b/lib/Tmdb/HttpClient/HttpClient.php @@ -237,4 +237,14 @@ public function getLastResponse() { return $this->lastResponse; } + + public function getBaseUrl() + { + return $this->getClient()->getBaseUrl(); + } + + public function setBaseUrl($url) + { + return $this->getClient()->setBaseUrl($url); + } } diff --git a/lib/Tmdb/HttpClient/HttpClientInterface.php b/lib/Tmdb/HttpClient/HttpClientInterface.php index bbce4cbe..a322f29f 100644 --- a/lib/Tmdb/HttpClient/HttpClientInterface.php +++ b/lib/Tmdb/HttpClient/HttpClientInterface.php @@ -99,4 +99,7 @@ public function delete($path, $body = null, array $parameters = array(), array $ * @return Response */ public function request(RequestInterface $request); + + public function getBaseUrl(); + public function setBaseUrl($url); }