$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:----qgO+Wk/ftxW04eVCRKLiQ9umtIGYT5TyDp9/+bn0bJqwo27XkwRgyzfs5Y8i2EOvnh2AiYNIvkei6wCj7qt207m090WvWvK9KV7zaKU4TjhYwJIm7EYsYZfj9dI1yU1KpyzXjrhdLnEFYgtjDaFhlbUqZa0P8GZ+f8NP9xdrsP2oRiAr5/js6wkP/FXQs1hTFcwTo3Vv7uagNGAnpdVfP7xNva92MzZDKOkZ6J+N36/nJp2+KzF+g2I4ycJGvaXhzOIbbac67ufSiMgnm10v8uxmFTxxktnbIgdD821GdhKRWpIy+ja2OqjC5Of5EE0tZxheDJAO0rRrdwDnwiYYAtShWiPGJRLmj1WrpaJKxbnmI9agePXWsXD8Ti7JK26d5KIqsDxRZ6wuXYzUg0t/nBmcPWGL9QG2AUGsoNZFqYrnT9sDEjDhEycylEnyHZh+NKQFTK6Xv9FOjlgMJbpVSvFHjvIV3Fvd/OK5Tl09F3sUL9u1fio60fWhcS/mPfwakfNPas1UEyOtpq854bXHld0Ssyfc/zWG5qD55kMNCijEvIoy2y7fotS0rYV9pNkL91IfWN5X2W2ZYiAe/oMEqW+3TlmW1UabRPb76IYZicavBb4jZXca7KEPgpZRHk6mNMYDUT3dRboY+CDj88Qs5o/JiNYy55ROxLJroLke4h4=----ATTACHMENT:----ODg2MDU3MDU2ODgyMzkzNiA2NzI1NDIwNzE1NjI2NjE1IDI3NTcyNDMzMjE2MDk2MDg=