Skip to content

Commit

Permalink
Merge pull request #96 from alma/feature/ecom-1477-php-client-fix-thr…
Browse files Browse the repository at this point in the history
…ow-exception-on-checkmandatorykeys-without

Fix throw exception on checkmandatorykeys without
  • Loading branch information
Benjamin-Freoua-Alma authored Mar 11, 2024
2 parents 80ed0ec + 6fa673d commit 55f8992
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
CHANGELOG
=========

v2.0.6
-------
* Fix error in throw exception without sprintf

v2.0.5
-------
* Fix endpoint customer-carts
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "alma/alma-php-client",
"description": "PHP API client for the Alma payments API",
"version": "2.0.5",
"version": "2.0.6",
"type": "library",
"require": {
"php": "^5.6 || ~7.0 || ~7.1 || ~7.2 || ~7.3 || ~7.4 || ~8.0 || ~8.1 || ~8.2",
Expand Down
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

class Client
{
const VERSION = '2.0.5';
const VERSION = '2.0.6';

const LIVE_MODE = 'live';
const TEST_MODE = 'test';
Expand Down
7 changes: 6 additions & 1 deletion src/Lib/ArrayUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ public function checkMandatoryKeys($keys, $array)
{
foreach ($keys as $key) {
if(!array_key_exists($key, $array)){
throw new MissingKeyException('The key "%s" is missing from the array "%s"', $key, json_encode($array));
throw new MissingKeyException(
sprintf(
'The key "%s" is missing from the array "%s"',
$key,
json_encode($array)
));
}
}
}
Expand Down

0 comments on commit 55f8992

Please sign in to comment.