Skip to content

Commit

Permalink
Made older PHP Versions working
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickbussmann committed Apr 29, 2022
1 parent 415e297 commit a317e52
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"require": {
"ext-json": "*",
"league/oauth2-client": "^2.0",
"firebase/php-jwt": "^6.0",
"firebase/php-jwt": "^5.2 || ^6.0",
"lcobucci/jwt": "^3.4 || ^4.0"
},
"require-dev": {
Expand Down
17 changes: 10 additions & 7 deletions src/Provider/Apple.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,17 @@ public function getAccessToken($grant, array $options = [])
*/
public function getConfiguration()
{
if (!method_exists(Signer\Ecdsa\Sha256::class, 'create')) {
throw new Exception('Cannot create Ecdsa\Sha256 configuration');
if (method_exists(Signer\Ecdsa\Sha256::class, 'create')) {
return Configuration::forSymmetricSigner(
Signer\Ecdsa\Sha256::create(),
$this->getLocalKey()
);
} else {
return Configuration::forSymmetricSigner(
new Signer\Ecdsa\Sha256(),
$this->getLocalKey()
);
}

return Configuration::forSymmetricSigner(
Signer\Ecdsa\Sha256::create(),
$this->getLocalKey()
);
}

/**
Expand Down

0 comments on commit a317e52

Please sign in to comment.