@@ -115,7 +115,9 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public function getAPIChallenge(bool $check_session = true): string |
| 117 | 117 | { |
| 118 | - if ($this->_api_challenge) return $this->_api_challenge; |
|
| 118 | + if ($this->_api_challenge) { |
|
| 119 | + return $this->_api_challenge; |
|
| 120 | + } |
|
| 119 | 121 | |
| 120 | 122 | if ($check_session && session_status() === PHP_SESSION_ACTIVE) { |
| 121 | 123 | $this->setAPIChallenge($_SESSION[self::API_CHALLENGE_PARAM] ?? ''); |
@@ -140,7 +142,9 @@ discard block |
||
| 140 | 142 | $url = URL::setGetVar('process_url', urlencode($process_url), $url); |
| 141 | 143 | $url = URL::setGetVar('error_url', urlencode($error_url), $url); |
| 142 | 144 | |
| 143 | - if ($this->getSiteKey()) $url = URL::setGetVar('site_key', $this->getSiteKey(), $url); |
|
| 145 | + if ($this->getSiteKey()) { |
|
| 146 | + $url = URL::setGetVar('site_key', $this->getSiteKey(), $url); |
|
| 147 | + } |
|
| 144 | 148 | |
| 145 | 149 | return URL::setGetVar('challenge', Utils::pack($challenge), $url); |
| 146 | 150 | } |
@@ -164,7 +168,9 @@ discard block |
||
| 164 | 168 | $json = $response->getJSON(); |
| 165 | 169 | |
| 166 | 170 | if (!$response->isValid() || !$json || !array_key_exists('access_token', $json)) { |
| 167 | - if (array_key_exists('error', $json)) throw new OAuthException($json['error']); |
|
| 171 | + if (array_key_exists('error', $json)) { |
|
| 172 | + throw new OAuthException($json['error']); |
|
| 173 | + } |
|
| 168 | 174 | return ''; |
| 169 | 175 | } else { |
| 170 | 176 | $this->setAccessToken($json['access_token']); |
@@ -186,7 +192,9 @@ discard block |
||
| 186 | 192 | */ |
| 187 | 193 | public function getAccessToken(bool $check_session = true): string |
| 188 | 194 | { |
| 189 | - if ($this->_access_token) return $this->_access_token; |
|
| 195 | + if ($this->_access_token) { |
|
| 196 | + return $this->_access_token; |
|
| 197 | + } |
|
| 190 | 198 | |
| 191 | 199 | if ($check_session && session_status() === PHP_SESSION_ACTIVE) { |
| 192 | 200 | $this->setAccessToken($_SESSION[self::ACCESS_TOKEN_PARAM] ?? ''); |