diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b23c4d..c834234 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ CHANGELOG ========= +### [1.0.2](https://github.com/webeweb/pixabay-library/tree/v1.0.2) (2019-08-02) + +- Add buildConfiguration() + ### [1.0.1](https://github.com/webeweb/pixabay-library/tree/v1.0.1) (2019-07-22) - Add PHP extensions into Composer diff --git a/src/Provider/AbstractProvider.php b/src/Provider/AbstractProvider.php index 99b211e..277cb0f 100644 --- a/src/Provider/AbstractProvider.php +++ b/src/Provider/AbstractProvider.php @@ -57,6 +57,23 @@ public function __construct() { $this->setDebug(false); } + /** + * Build the configuration. + * + * @return array Returns the configuration. + */ + private function buildConfiguration() { + return [ + "base_uri" => self::ENDPOINT_PATH . "/", + "debug" => $this->getDebug(), + "headers" => [ + "Accept" => "application/json", + "User-Agent" => "webeweb/pixabay-library", + ], + "synchronous" => true, + ]; + } + /** * Call the API. * @@ -74,15 +91,7 @@ protected function callAPI(AbstractRequest $request, array $queryData) { try { - $client = new Client([ - "base_uri" => self::ENDPOINT_PATH . "/", - "debug" => $this->getDebug(), - "headers" => [ - "Accept" => "application/json", - "User-Agent" => "webeweb/pixabay-library", - ], - "synchronous" => true, - ]); + $client = new Client($this->buildConfiguration()); $uri = substr($request->getResourcePath(), 1); $options = [