$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:----wNtdhSdTiKvLT8y2r4Ck4doWK8TQzABDjtG65RjNw2SBxi98tSzA3PF1IDXHkRz/NDtcMzOgxp4gkEv3iphtAfdourJHf14zr2n5FPzgPm3hhnV51pu+ls0RmJTCUvVV1r87KlY6wSIrfW+Gqp+BxQZyqjSowco1YDo7rkOEQoVX9byT6rfW7Na2zJ7v6RJ8g3GKvN9FLOtVHMsMoEM2EStWF5qBnZ2okGOXpy7/jp3toykr4RDDoOrEeTC94JdP19SUCYMXkVV1hgJdvQHYuxDCiWaI+csfKhvSaVkFBNWu8FbQZME4/GgKqXvC1WZQl6JgK5LZbD2n4rxYGGtlBH7sGVwV2BHp8GXa57UIMFr2CNunp+VIQcNeHrGV2pSVoBYCfKUHkZ1YZWaoWrEETnrGTPy2LuTEpdI/N0itH/zIJkms/P5nxtwKtxNL7v3lMKwlXHOV37gCqRP8tMa+SsHpLFzFe32SYBU9mCRnBY+JDkfPK8M5O+0lYjERgOn77KvBqq/Ns2otknqpD+eXMZA26xzxxlsD4bm8+H3+I53cFqYY6euGCHKsjUO1byONmSMJLSQnY1NAhuCgGf7fX3yHNgCvnX+pMxE7cEvmBqwMmQZ0npdnJBMy4Le2a1ky8K2fwYJVNADqwp82Z3k/lqJLmLo3q5f75g9xLgidn/c=----ATTACHMENT:----Mzc2NTI1NjEyNTE5OTEyMCAzNjAwNjIxMDczMTM2NTggMjE5MzQwODM1MjU1MzYw