From 6d967dbb4e21f143a7acb5e360ae3f1b6a9a73b9 Mon Sep 17 00:00:00 2001 From: Carlos Betancourt Carrero Date: Wed, 4 Nov 2020 17:23:13 +0100 Subject: [PATCH 1/2] Load the composer file directly from the package dir --- src/Bynder/Api/Impl/OAuth2/Configuration.php | 7 ++++--- src/Bynder/Api/Impl/PermanentTokens/Configuration.php | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Bynder/Api/Impl/OAuth2/Configuration.php b/src/Bynder/Api/Impl/OAuth2/Configuration.php index aac319e..8007a6d 100644 --- a/src/Bynder/Api/Impl/OAuth2/Configuration.php +++ b/src/Bynder/Api/Impl/OAuth2/Configuration.php @@ -17,7 +17,7 @@ class Configuration { private $bynderDomain; - + private $rootDir; private $redirectUri; /** @@ -52,7 +52,8 @@ public function __construct($bynderDomain, $redirectUri, $clientId, $clientSecre $this->clientSecret = $clientSecret; $this->token = $token; $this->requestOptions = $requestOptions; - $this->package = json_decode(file_get_contents('composer.json')); + $this->rootDir = dirname(__FILE__, 6); + $this->package = json_decode(file_get_contents($this->rootDir . '/composer.json')); $this->initialToken = $token; } @@ -145,6 +146,6 @@ public function setRequestOptions(array $requestOptions) */ public function getSdkVersion() { - return $this->package['version']; + return $this->package->version; } } diff --git a/src/Bynder/Api/Impl/PermanentTokens/Configuration.php b/src/Bynder/Api/Impl/PermanentTokens/Configuration.php index 52c6d31..6637e29 100644 --- a/src/Bynder/Api/Impl/PermanentTokens/Configuration.php +++ b/src/Bynder/Api/Impl/PermanentTokens/Configuration.php @@ -12,6 +12,7 @@ class Configuration { private $bynderDomain; + private $rootDir; /** * @var string Permanent token. @@ -30,7 +31,8 @@ public function __construct($bynderDomain, $token, $requestOptions = []) $this->bynderDomain = $bynderDomain; $this->token = $token; $this->requestOptions = $requestOptions; - $this->package = json_decode(file_get_contents('composer.json')); + $this->rootDir = dirname(__FILE__, 6); + $this->package = json_decode(file_get_contents($this->rootDir . '/composer.json')); } public function getBynderDomain() @@ -80,6 +82,6 @@ public function setRequestOptions(array $requestOptions) */ public function getSdkVersion() { - return $this->package['version']; + return $this->package->version; } } From 41596997ee1bb4d5f8c9355584c12e45b009e061 Mon Sep 17 00:00:00 2001 From: Carlos Betancourt Carrero Date: Wed, 4 Nov 2020 17:23:32 +0100 Subject: [PATCH 2/2] Version bump --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4ce345b..92c7fa6 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "bynder/bynder-php-sdk", "description": "Bynder PHP Library", - "version": "2.1.1", + "version": "2.1.2", "keywords": [ "bynder", "sdk",