| @@ 110-112 (lines=3) @@ | ||
| 107 | } |
|
| 108 | ||
| 109 | $responseObj = json_decode($response); |
|
| 110 | if (is_null($jsonObj) || json_last_error() !== JSON_ERROR_NONE) { |
|
| 111 | throw new AuthenticationException('Authentication response body is not (valid) json.', json_last_error()); |
|
| 112 | } |
|
| 113 | ||
| 114 | if ($responseObj->access_token && $responseObj->refresh_token) { |
|
| 115 | $this->access_token = $responseObj->access_token; |
|
| @@ 147-149 (lines=3) @@ | ||
| 144 | } |
|
| 145 | ||
| 146 | $responseObj = json_decode($response['body']); |
|
| 147 | if (is_null($responseObj) || json_last_error() !== JSON_ERROR_NONE) { |
|
| 148 | throw new AuthenticationException('Authentication response body is not (valid) json.', json_last_error()); |
|
| 149 | } |
|
| 150 | ||
| 151 | if (property_exists($responseObj, 'access_token') && property_exists($responseObj, 'refresh_token')) { |
|
| 152 | $this->accessToken = $responseObj->access_token; |
|
| @@ 506-508 (lines=3) @@ | ||
| 503 | public static function getValidJsonObj($jsonString) |
|
| 504 | { |
|
| 505 | $jsonObj = json_decode($jsonString); |
|
| 506 | if (is_null($jsonObj) || json_last_error() !== JSON_ERROR_NONE) { |
|
| 507 | throw new InvalidDataException('Response body is not (valid) json.', json_last_error()); |
|
| 508 | } |
|
| 509 | ||
| 510 | return $jsonObj; |
|
| 511 | } |
|