for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Created by PhpStorm.
* User: xiabin
* Date: 16/6/24
* Time: 下午7:12
*/
namespace Xiabin\OAuth2\Client\Provider\Exception;
use Psr\Http\Message\ResponseInterface;
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
class SinaWeiboIdentityProviderException extends IdentityProviderException
{
* Creates client exception from response.
*
* @param ResponseInterface $response
* @param string $data Parsed response data
* @return IdentityProviderException
public static function clientException(ResponseInterface $response, $data)
return static::fromResponse(
$response,
isset($data['message']) ? $data['message'] : $response->getReasonPhrase()
);
}
* Creates oauth exception from response.
public static function oauthException(ResponseInterface $response, $data)
isset($data['error']) ? $data['error'] : $response->getReasonPhrase()
* Creates identity exception from response.
* @param string $message
protected static function fromResponse(ResponseInterface $response, $message = null)
return new static($message, $response->getStatusCode(), (string)$response->getBody());