From cf5d58eea3545f2b8e9887cb98d1f05fbbd55111 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Mon, 1 Aug 2016 11:15:24 +0200 Subject: [PATCH] Removed setter for ApiVersion and EnterpriceUrl --- lib/Github/Client.php | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/lib/Github/Client.php b/lib/Github/Client.php index ffbe5f2399d..582351505c9 100644 --- a/lib/Github/Client.php +++ b/lib/Github/Client.php @@ -159,7 +159,8 @@ public function __construct(HttpClient $httpClient = null, $apiVersion = null, $ 'User-Agent' => 'php-github-api (http://github.com/KnpLabs/php-github-api)', ))); - $this->setApiVersion($apiVersion ?: 'v3'); + $this->apiVersion = $apiVersion ?: 'v3'; + $this->addHeaders(['Accept' => sprintf('application/vnd.github.%s+json', $this->apiVersion)]); if ($enterpriseUrl) { $this->setEnterpriseUrl($enterpriseUrl); @@ -305,7 +306,7 @@ public function authenticate($tokenOrLogin, $password = null, $authMethod = null * * @param string $enterpriseUrl URL of the API in the form of http(s)://hostname */ - public function setEnterpriseUrl($enterpriseUrl) + private function setEnterpriseUrl($enterpriseUrl) { $this->removePlugin(Plugin\AddHostPlugin::class); $this->removePlugin(PathPrepend::class); @@ -375,21 +376,6 @@ public function getApiVersion() return $this->apiVersion; } - /** - * @param string $apiVersion - * - * @return Client - */ - public function setApiVersion($apiVersion) - { - $this->apiVersion = $apiVersion; - $this->addHeaders([ - 'Accept' => sprintf('application/vnd.github.%s+json', $apiVersion), - ]); - - return $this; - } - /** * Clears used headers. */