Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Improve constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Nesmeyanov Kirill committed Feb 6, 2017
1 parent 9fd25b6 commit 8955b75
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,16 @@ class Client implements ClientContract
public function __construct($version = null, ClientInterface $http = null)
{
$this->version = $version ?: static::API_VERSION;
$this->http = $http ?: new HttpClient([
$this->http = $this->resolveHttpClient($http);
}

/**
* @param ClientInterface|null $http
* @return ClientInterface
*/
private function resolveHttpClient(ClientInterface $http = null)
{
return $http ?: new HttpClient([
'base_uri' => static::API_URI,
'timeout' => static::API_TIMEOUT,
'http_errors' => false,
Expand Down

0 comments on commit 8955b75

Please sign in to comment.