diff --git a/Api.php b/Api.php index 862b466..1fe6774 100644 --- a/Api.php +++ b/Api.php @@ -32,7 +32,7 @@ class Api * @var ClientInterface */ private $client; - + /** * @param AuthInterface $auth */ diff --git a/Client/Client.php b/Client/Client.php index 72b9c21..5618ab8 100644 --- a/Client/Client.php +++ b/Client/Client.php @@ -6,12 +6,24 @@ class Client implements ClientInterface { - /** * @var string */ private $baseUrl = 'https://sms.ru/{method}'; + /** + * @var \GuzzleHttp\Client + */ + private $client; + + /** + * @param array $config Additional configuration for Guzzle Client + */ + public function __construct($config = []) + { + $this->client = new \GuzzleHttp\Client($config); + } + /** * @param string $method * @param array $params @@ -22,9 +34,7 @@ class Client implements ClientInterface */ public function request($method, $params = []) { - $client = new \GuzzleHttp\Client(); - - $response = $client->post($this->getUrl($method), ['query' => $params]); + $response = $this->client->post($this->getUrl($method), ['query' => $params]); if ($response->getStatusCode() === 200) { return (string)$response->getBody();