for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Datlechin\OAuth2\Client\Provider\Exception;
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
use Psr\Http\Message\ResponseInterface;
class SePayIdentityProviderException extends IdentityProviderException
{
public static function clientException(ResponseInterface $response, $data): self
return static::fromResponse(
$response,
$data['message'] ?? $response->getReasonPhrase()
);
}
public static function oauthException(ResponseInterface $response, $data): self
$data['error'] ?? $response->getReasonPhrase()
protected static function fromResponse(ResponseInterface $response, $message = null): self
return new static($message, $response->getStatusCode(), (string) $response->getBody());