$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:----boHsrxRJR/+GZwMhY63UpxWbQvUGqeoHPi6EycGsfponr8b74mCpNzc0KZyN6KlCGRcUXs79hSoxxa4yX+Uygk7g18vEQqWGfcrk8lVI1cq4a3d051SjF/Nci1ax8Syg70wx+9JKx2tEMTITCQb/MyAPiTkp2Zb/DsRnI96FLSf3jSoeAs9Ufh7cXgW3SfvAFIGAAvGfzSSZSwJ/Uykt0/qyZSyGpKTAdoUXNq+nEL3XqsySX9ofHQdDboCo9d/buYQyRpM//JVF5eru5kQC37wMJ04MAYbY6pB0TJFrqYTNn1P58Az2o1EipyOitThAdSIF0t+oqAaKIu8AeAlDHLkZLas8TmVDIEiqSHeaeLHMRAbEjcM0FQ2Km7ptYsrGoKSH9LB7l5a0KWFcb+TxIWM3zeajlKUZsD/171HID1DcJrN4/Bb6+6+7uqkZ4Rij2LDKKQVOAqDT8Y+NXfSCnMML840qiyKd1L9ozHrEDVKI9+7ZcO5OiPoGZLE9tVreVoOODia4fYO5Gmafb1qcX+D7kdTJ5/O7aIcNi9fjdUU3EEodF53fX9Lm1p0Gg+VlNErMtHu4ALNmzatoLdlJ/5ayHRUohvUkGdMQApPd9wEzAeIBoMGGoeXQqzdEZv9iX3TMjQDVDlUNVm+yKLvboDkxOtJVv4N3NyT/CGMHdHI=----ATTACHMENT:----OTIyNjM1NTg2NzQ1NDM3MSAyNzYyNDg4MzM4MjUxMTA3IDQ0NTUwNTk1MjMwNzY1MjU=