@@ 91-94 (lines=4) @@ | ||
88 | throw new RuntimeException(sprintf('response MUST have JSON content type')); |
|
89 | } |
|
90 | $decodedJson = json_decode($this->responseBody, true); |
|
91 | if (is_null($decodedJson) && JSON_ERROR_NONE !== json_last_error()) { |
|
92 | $errorMsg = function_exists('json_last_error_msg') ? json_last_error_msg() : json_last_error(); |
|
93 | throw new RuntimeException(sprintf('unable to decode JSON: %s', $errorMsg)); |
|
94 | } |
|
95 | ||
96 | return $decodedJson; |
|
97 | } |
@@ 133-136 (lines=4) @@ | ||
130 | public static function fromStorage($tokenString) |
|
131 | { |
|
132 | $tokenData = json_decode($tokenString, true); |
|
133 | if (is_null($tokenData) && JSON_ERROR_NONE !== json_last_error()) { |
|
134 | $errorMsg = function_exists('json_last_error_msg') ? json_last_error_msg() : json_last_error(); |
|
135 | throw new AccessTokenException(sprintf('unable to decode JSON from storage: %s', $errorMsg)); |
|
136 | } |
|
137 | ||
138 | return new self($tokenData); |
|
139 | } |