InvalidRequestException.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace Stripe\Exception;
  3. /**
  4. * InvalidRequestException is thrown when a request is initiated with invalid
  5. * parameters.
  6. */
  7. class InvalidRequestException extends ApiErrorException
  8. {
  9. protected $stripeParam;
  10. /**
  11. * Creates a new InvalidRequestException exception.
  12. *
  13. * @param string $message the exception message
  14. * @param null|int $httpStatus the HTTP status code
  15. * @param null|string $httpBody the HTTP body as a string
  16. * @param null|array $jsonBody the JSON deserialized body
  17. * @param null|array|\Stripe\Util\CaseInsensitiveArray $httpHeaders the HTTP headers array
  18. * @param null|string $stripeCode the Stripe error code
  19. * @param null|string $stripeParam the parameter related to the error
  20. *
  21. * @return InvalidRequestException
  22. */
  23. public static function factory(
  24. $message,
  25. $httpStatus = null,
  26. $httpBody = null,
  27. $jsonBody = null,
  28. $httpHeaders = null,
  29. $stripeCode = null,
  30. $stripeParam = null
  31. ) {
  32. $instance = parent::factory($message, $httpStatus, $httpBody, $jsonBody, $httpHeaders, $stripeCode);
  33. $instance->setStripeParam($stripeParam);
  34. return $instance;
  35. }
  36. /**
  37. * Gets the parameter related to the error.
  38. *
  39. * @return null|string
  40. */
  41. public function getStripeParam()
  42. {
  43. return $this->stripeParam;
  44. }
  45. /**
  46. * Sets the parameter related to the error.
  47. *
  48. * @param null|string $stripeParam
  49. */
  50. public function setStripeParam($stripeParam)
  51. {
  52. $this->stripeParam = $stripeParam;
  53. }
  54. }