Skip to content

Commit

Permalink
Set back PHP minimum version to 5.x #232
Browse files Browse the repository at this point in the history
  • Loading branch information
vdesabou committed Feb 9, 2018
1 parent fef4bd7 commit 637bcce
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected function parseBody($body, $status)
}

$body = json_decode($body);
$error = $body->error ?? null;
$error = (isset($body->error)) ? $body->error : null;

if (isset($error->message) && isset($error->status)) {
// API call error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getAuthorizeUrl($options = [])
'response_type' => 'code',
'scope' => isset($options['scope']) ? implode(' ', $options['scope']) : null,
'show_dialog' => !empty($options['show_dialog']) ? 'true' : null,
'state' => $options['state'] ?? null,
'state' => isset($options['state']) ? $options['state'] : null,
];

return Request::ACCOUNT_URL . '/authorize/?' . http_build_query($parameters);
Expand Down Expand Up @@ -152,8 +152,12 @@ public function refreshAccessToken($refreshToken)
if (isset($response->access_token)) {
$this->accessToken = $response->access_token;
$this->expirationTime = time() + $response->expires_in;
$this->scope = $response->scope ?? $this->scope;
$this->refreshToken = $response->refresh_token ?? $this->refreshToken;
if (isset($response->scope)) {
$this->scope = $response->scope;
}
if (isset($response->refresh_token)) {
$this->refreshToken = $response->refreshToken;
}

return true;
}
Expand Down Expand Up @@ -184,8 +188,9 @@ public function requestCredentialsToken()
if (isset($response->access_token)) {
$this->accessToken = $response->access_token;
$this->expirationTime = time() + $response->expires_in;
$this->scope = $response->scope ?? $this->scope;

if (isset($response->scope)) {
$this->scope = $response->scope;
}
return true;
}

Expand Down Expand Up @@ -216,8 +221,9 @@ public function requestAccessToken($authorizationCode)
$this->refreshToken = $response->refresh_token;
$this->accessToken = $response->access_token;
$this->expirationTime = time() + $response->expires_in;
$this->scope = $response->scope ?? $this->scope;

if (isset($response->scope)) {
$this->scope = $response->scope;
}
return true;
}

Expand Down

0 comments on commit 637bcce

Please sign in to comment.