Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions lib/Github/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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.
*/
Expand Down