diff --git a/CHANGELOG.md b/CHANGELOG.md index 172ab46..b758d0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +### [2.4.3](https://github.com/webeweb/smsmode-library/tree/v2.4.3) (2019-08-02) + +- Add buildConfiguration() method +- Fix PHPDoc + ### [2.4.2](https://github.com/webeweb/smsmode-library/tree/v2.4.2) (2019-07-22) - Add PHP extensions into Composer diff --git a/src/Provider/AbstractProvider.php b/src/Provider/AbstractProvider.php index 649edcd..3d8c22d 100644 --- a/src/Provider/AbstractProvider.php +++ b/src/Provider/AbstractProvider.php @@ -67,6 +67,23 @@ public function __construct(Authentication $authentication) { $this->setRequestNormalizer(new RequestNormalizer()); } + /** + * Build the configuration. + * + * @return array Returns the configuration. + */ + private function buildConfiguration() { + return [ + "base_uri" => self::ENDPOINT_PATH . "/", + "debug" => $this->getDebug(), + "headers" => [ + "Accept" => "text/html", + "User-Agent" => "webeweb/smsmode-library", + ], + "synchronous" => true, + ]; + } + /** * Call API. * @@ -81,15 +98,7 @@ protected function callAPI(AbstractRequest $request, array $queryData, array $po try { - $client = new Client([ - "base_uri" => self::ENDPOINT_PATH . "/", - "debug" => $this->getDebug(), - "headers" => [ - "Accept" => "text/html", - "User-Agent" => "webeweb/smsmode-library", - ], - "synchronous" => true, - ]); + $client = new Client($this->buildConfiguration()); $method = 0 === count($postData) ? "GET" : "POST"; $uri = substr($request->getResourcePath(), 1); @@ -141,7 +150,7 @@ public function getRequestNormalizer() { * Set the authentication. * * @param Authentication $authentication The authentication. - * @return APIProvider Returns this provider. + * @return AbstractProvider Returns this provider. */ protected function setAuthentication(Authentication $authentication) { $this->authentication = $authentication; @@ -152,7 +161,7 @@ protected function setAuthentication(Authentication $authentication) { * Set the debug. * * @param bool $debug The debug. - * @return APIProvider Returns this provider. + * @return AbstractProvider Returns this provider. */ public function setDebug($debug) { $this->debug = $debug; @@ -163,7 +172,7 @@ public function setDebug($debug) { * Set the request normalizer. * * @param RequestNormalizer $requestNormalizer - * @return APIProvider Returns this provider. + * @return AbstractProvider Returns this provider. */ protected function setRequestNormalizer(RequestNormalizer $requestNormalizer) { $this->requestNormalizer = $requestNormalizer;