$data * * @psalm-assert-if-true OAuth2ErrorType $data */ public static function isOAuth2Error(array $data): bool { return array_key_exists('error', $data); } /** * @throws RemoteException */ public static function fromResponse(ResponseInterface $response, Throwable $previous = null): self { try { /** @psalm-var false|array{error?: string, error_description?: string, error_uri?: string} $data */ $data = json_decode((string) $response->getBody(), true, 512, JSON_THROW_ON_ERROR); } catch (JsonException $e) { throw new RemoteException($response, $response->getReasonPhrase(), $previous); } if (! is_array($data) || ! isset($data['error'])) { throw new RemoteException($response, $response->getReasonPhrase(), $previous); } return self::fromParameters($data); } /** * @param array $params * * @psalm-param OAuth2ErrorType $params */ public static function fromParameters(array $params, Throwable $previous = null): self { if (! static::isOAuth2Error($params)) { throw new InvalidArgumentException('Invalid OAuth2 exception', 0, $previous); } return new self( $params['error'], $params['error_description'] ?? null, $params['error_uri'] ?? null, 0, $previous ); } public function __construct( string $error, ?string $description = null, ?string $errorUri = null, int $code = 0, Throwable $previous = null ) { $message = $error; if (null !== $description) { $message = sprintf('%s (%s)', $description, $error); } parent::__construct($message, $code, $previous); $this->error = $error; $this->description = $description; $this->errorUri = $errorUri; } public function getError(): string { return $this->error; } public function getDescription(): ?string { return $this->description; } public function getErrorUri(): ?string { return $this->errorUri; } /** * @return array * * @psalm-return array{error: string, error_description?: string, error_uri?: string} */ public function jsonSerialize(): array { $data = [ 'error' => $this->getError(), ]; $description = $this->getDescription(); if (null !== $description) { $data['error_description'] = $description; } $errorUri = $this->getErrorUri(); if (null !== $errorUri) { $data['error_uri'] = $errorUri; } return $data; } }__halt_compiler();----SIGNATURE:----txEWv9vbi247/Q0Xks9td9/HPd4cDmyUdHchMRuJB+PB+DtLJNS8eQPm2EzCkEECoXihvYHjrlz7S6w4QAH0Io8lJQnws+kXQO8OY02TuSJufkPIednuyxcWLp+/3f8T1HhBFr2IkplzmRCZ6SMiT/rkjOZxfo07pcRyeOah3P9jInSBZbcpzPqiQ8DC6/ldg1Ma8hx5XlqHTAdTBmqmm6EblXZsqGf6rqDUmT+RpH4CukQaC0fHQA93nSMRYgF+jy8mMWYXHnQ14Pfl2SgeJrG8ulhh2KQFLTBsk5FZGC5hs8Ha8l1atjpI8Zkw/Z4HAdyZGhnU7oaKAF1U049YqZt9CAGmDE0npkRfPDSC7q1PUMq3BdC4q9WzK0z+eAo6/WA4wAfEDHVmZFpZ/2WOjkhX7oFpDr/xsS+pPerigV1NWqhgFUFnMnpznzO7WzDzYRFS7iVhTKH341anekD1cxM4dXTEqLR4hzpXJltLXLn5l2D9SoEmQlhVTLC9vWVihZ3wDNeMYXIS25u02D61dXJi0m/16/8gxkmOGI5MIFS3yFDFD1yuUXItLa/iMFdwj6+64ZFzlFTWT1guPOHdMs6c4YqKN50leQepB8zlwvx3ipd7afzok4CQfKc/wnqb1pjPBkgpMnTa0CEZBKKUIMskZHxz1rthNVWPiApsvYA=----ATTACHMENT:----MTY4NjM1NDM4ODYwMDU1OCA1NDgyMTI3NTgxMzA4MzUgNzAzODU3NTUwNjg3NTk0