From 75160b12821f7f4299cce7f0b69c83c1502ae071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Mon, 27 May 2024 13:08:29 +0200 Subject: 2024-02-19 upstream --- .../stripe-php/lib/Exception/ApiErrorException.php | 438 ++++++++++----------- 1 file changed, 219 insertions(+), 219 deletions(-) (limited to 'vendor/stripe/stripe-php/lib/Exception/ApiErrorException.php') diff --git a/vendor/stripe/stripe-php/lib/Exception/ApiErrorException.php b/vendor/stripe/stripe-php/lib/Exception/ApiErrorException.php index 995a42e..2d96e6b 100644 --- a/vendor/stripe/stripe-php/lib/Exception/ApiErrorException.php +++ b/vendor/stripe/stripe-php/lib/Exception/ApiErrorException.php @@ -1,219 +1,219 @@ -setHttpStatus($httpStatus); - $instance->setHttpBody($httpBody); - $instance->setJsonBody($jsonBody); - $instance->setHttpHeaders($httpHeaders); - $instance->setStripeCode($stripeCode); - - $instance->setRequestId(null); - if ($httpHeaders && isset($httpHeaders['Request-Id'])) { - $instance->setRequestId($httpHeaders['Request-Id']); - } - - $instance->setError($instance->constructErrorObject()); - - return $instance; - } - - /** - * Gets the Stripe error object. - * - * @return null|\Stripe\ErrorObject - */ - public function getError() - { - return $this->error; - } - - /** - * Sets the Stripe error object. - * - * @param null|\Stripe\ErrorObject $error - */ - public function setError($error) - { - $this->error = $error; - } - - /** - * Gets the HTTP body as a string. - * - * @return null|string - */ - public function getHttpBody() - { - return $this->httpBody; - } - - /** - * Sets the HTTP body as a string. - * - * @param null|string $httpBody - */ - public function setHttpBody($httpBody) - { - $this->httpBody = $httpBody; - } - - /** - * Gets the HTTP headers array. - * - * @return null|array|\Stripe\Util\CaseInsensitiveArray - */ - public function getHttpHeaders() - { - return $this->httpHeaders; - } - - /** - * Sets the HTTP headers array. - * - * @param null|array|\Stripe\Util\CaseInsensitiveArray $httpHeaders - */ - public function setHttpHeaders($httpHeaders) - { - $this->httpHeaders = $httpHeaders; - } - - /** - * Gets the HTTP status code. - * - * @return null|int - */ - public function getHttpStatus() - { - return $this->httpStatus; - } - - /** - * Sets the HTTP status code. - * - * @param null|int $httpStatus - */ - public function setHttpStatus($httpStatus) - { - $this->httpStatus = $httpStatus; - } - - /** - * Gets the JSON deserialized body. - * - * @return null|array - */ - public function getJsonBody() - { - return $this->jsonBody; - } - - /** - * Sets the JSON deserialized body. - * - * @param null|array $jsonBody - */ - public function setJsonBody($jsonBody) - { - $this->jsonBody = $jsonBody; - } - - /** - * Gets the Stripe request ID. - * - * @return null|string - */ - public function getRequestId() - { - return $this->requestId; - } - - /** - * Sets the Stripe request ID. - * - * @param null|string $requestId - */ - public function setRequestId($requestId) - { - $this->requestId = $requestId; - } - - /** - * Gets the Stripe error code. - * - * Cf. the `CODE_*` constants on {@see \Stripe\ErrorObject} for possible - * values. - * - * @return null|string - */ - public function getStripeCode() - { - return $this->stripeCode; - } - - /** - * Sets the Stripe error code. - * - * @param null|string $stripeCode - */ - public function setStripeCode($stripeCode) - { - $this->stripeCode = $stripeCode; - } - - /** - * Returns the string representation of the exception. - * - * @return string - */ - public function __toString() - { - $statusStr = (null === $this->getHttpStatus()) ? '' : "(Status {$this->getHttpStatus()}) "; - $idStr = (null === $this->getRequestId()) ? '' : "(Request {$this->getRequestId()}) "; - - return "{$statusStr}{$idStr}{$this->getMessage()}"; - } - - protected function constructErrorObject() - { - if (null === $this->jsonBody || !\array_key_exists('error', $this->jsonBody)) { - return null; - } - - return \Stripe\ErrorObject::constructFrom($this->jsonBody['error']); - } -} +setHttpStatus($httpStatus); + $instance->setHttpBody($httpBody); + $instance->setJsonBody($jsonBody); + $instance->setHttpHeaders($httpHeaders); + $instance->setStripeCode($stripeCode); + + $instance->setRequestId(null); + if ($httpHeaders && isset($httpHeaders['Request-Id'])) { + $instance->setRequestId($httpHeaders['Request-Id']); + } + + $instance->setError($instance->constructErrorObject()); + + return $instance; + } + + /** + * Gets the Stripe error object. + * + * @return null|\Stripe\ErrorObject + */ + public function getError() + { + return $this->error; + } + + /** + * Sets the Stripe error object. + * + * @param null|\Stripe\ErrorObject $error + */ + public function setError($error) + { + $this->error = $error; + } + + /** + * Gets the HTTP body as a string. + * + * @return null|string + */ + public function getHttpBody() + { + return $this->httpBody; + } + + /** + * Sets the HTTP body as a string. + * + * @param null|string $httpBody + */ + public function setHttpBody($httpBody) + { + $this->httpBody = $httpBody; + } + + /** + * Gets the HTTP headers array. + * + * @return null|array|\Stripe\Util\CaseInsensitiveArray + */ + public function getHttpHeaders() + { + return $this->httpHeaders; + } + + /** + * Sets the HTTP headers array. + * + * @param null|array|\Stripe\Util\CaseInsensitiveArray $httpHeaders + */ + public function setHttpHeaders($httpHeaders) + { + $this->httpHeaders = $httpHeaders; + } + + /** + * Gets the HTTP status code. + * + * @return null|int + */ + public function getHttpStatus() + { + return $this->httpStatus; + } + + /** + * Sets the HTTP status code. + * + * @param null|int $httpStatus + */ + public function setHttpStatus($httpStatus) + { + $this->httpStatus = $httpStatus; + } + + /** + * Gets the JSON deserialized body. + * + * @return null|array + */ + public function getJsonBody() + { + return $this->jsonBody; + } + + /** + * Sets the JSON deserialized body. + * + * @param null|array $jsonBody + */ + public function setJsonBody($jsonBody) + { + $this->jsonBody = $jsonBody; + } + + /** + * Gets the Stripe request ID. + * + * @return null|string + */ + public function getRequestId() + { + return $this->requestId; + } + + /** + * Sets the Stripe request ID. + * + * @param null|string $requestId + */ + public function setRequestId($requestId) + { + $this->requestId = $requestId; + } + + /** + * Gets the Stripe error code. + * + * Cf. the `CODE_*` constants on {@see \Stripe\ErrorObject} for possible + * values. + * + * @return null|string + */ + public function getStripeCode() + { + return $this->stripeCode; + } + + /** + * Sets the Stripe error code. + * + * @param null|string $stripeCode + */ + public function setStripeCode($stripeCode) + { + $this->stripeCode = $stripeCode; + } + + /** + * Returns the string representation of the exception. + * + * @return string + */ + public function __toString() + { + $statusStr = (null === $this->getHttpStatus()) ? '' : "(Status {$this->getHttpStatus()}) "; + $idStr = (null === $this->getRequestId()) ? '' : "(Request {$this->getRequestId()}) "; + + return "{$statusStr}{$idStr}{$this->getMessage()}"; + } + + protected function constructErrorObject() + { + if (null === $this->jsonBody || !\array_key_exists('error', $this->jsonBody)) { + return null; + } + + return \Stripe\ErrorObject::constructFrom($this->jsonBody['error']); + } +} -- cgit v1.2.3