Skip to content

Commit

Permalink
Update error handling in BookboonProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
lkm committed May 7, 2020
1 parent 3b26ff3 commit 30483ff
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Client/Oauth/BookboonProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class BookboonProvider extends AbstractProvider

public function __construct(array $options = [], array $collaborators = [])
{
if (isset($options['baseUri']) && $options['baseUri'] != "") {
if (isset($options['baseUri']) && $options['baseUri'] !== "") {
$parts = explode('://', $options['baseUri']);
$this->protocol = $parts[0];
$this->host = $parts[1];
Expand All @@ -50,7 +50,7 @@ public function __construct(array $options = [], array $collaborators = [])
*/
public function getBaseAuthorizationUrl()
{
return $this->protocol . "://" . $this->host . "/login/authorize";
return "$this->protocol://$this->host/login/authorize";
}

/**
Expand All @@ -63,7 +63,7 @@ public function getBaseAuthorizationUrl()
*/
public function getBaseAccessTokenUrl(array $params)
{
return $this->protocol . "://" . $this->host . "/login/access_token";
return "$this->protocol://$this->host/login/access_token";
}

/**
Expand All @@ -74,7 +74,7 @@ public function getBaseAccessTokenUrl(array $params)
*/
public function getResourceOwnerDetailsUrl(AccessToken $token)
{
return $this->protocol . "://" . $this->host . "/login/userinfo";
return "$this->protocol://$this->host/login/userinfo";
}


Expand All @@ -96,7 +96,7 @@ public function getAccessToken($grant, array $options = [])
}

if (is_array($options['scope'])) {
$options['scope'] = join($this->getScopeSeparator(), $options['scope']);
$options['scope'] = implode($this->getScopeSeparator(), $options['scope']);
}

return parent::getAccessToken($grant, $options);
Expand Down Expand Up @@ -125,9 +125,9 @@ protected function getDefaultScopes()
*/
protected function checkResponse(ResponseInterface $response, $data)
{
if (is_array($data) && isset($data['error'])) {
if (isset($data['errors'])) {
throw new IdentityProviderException(
$data['error'] ?? $response->getReasonPhrase(),
$data['errors'][0]['title'] ?? $response->getReasonPhrase(),
$response->getStatusCode(),
$response->getBody()
);
Expand Down

0 comments on commit 30483ff

Please sign in to comment.