getReasonPhrase() ); } /** * Creates oauth exception from response. * * @param ResponseInterface $response * @param string $data Parsed response data * * @return IdentityProviderException */ public static function oauthException(ResponseInterface $response, $data) { return static::fromResponse( $response, isset($data['error']) ? $data['error'] : $response->getReasonPhrase() ); } /** * Creates identity exception from response. * * @param ResponseInterface $response * @param string $message * * @return IdentityProviderException */ protected static function fromResponse(ResponseInterface $response, $message = null) { return new static($message, $response->getStatusCode(), (string) $response->getBody()); } }