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