| @@ 7-55 (lines=49) @@ | ||
| 4 | /** |
|
| 5 | * This is an exception that is thrown when an error occurs with the API responses. |
|
| 6 | */ |
|
| 7 | class YourMembershipRequestException extends YourMembershipException |
|
| 8 | { |
|
| 9 | ||
| 10 | /** |
|
| 11 | * Arguments used for the Request |
|
| 12 | * @var array |
|
| 13 | */ |
|
| 14 | private $arguments; |
|
| 15 | ||
| 16 | /** |
|
| 17 | * Api Method That is related to this exception |
|
| 18 | * @var string |
|
| 19 | */ |
|
| 20 | private $apiMethod; |
|
| 21 | ||
| 22 | public function __construct(string $message, int $code = 0, string $apiMethod, array $arguments, \Exception $e = null) |
|
| 23 | { |
|
| 24 | $this->apiMethod = $apiMethod; |
|
| 25 | $this->arguments = $arguments; |
|
| 26 | parent::__construct($message, $code, $e); |
|
| 27 | } |
|
| 28 | ||
| 29 | /** |
|
| 30 | * Returns the arguments for API Request |
|
| 31 | * @method getArguments |
|
| 32 | * @author PA |
|
| 33 | * @date 2017-01-12 |
|
| 34 | * @return array |
|
| 35 | */ |
|
| 36 | ||
| 37 | public function getArguments() : array |
|
| 38 | { |
|
| 39 | return $this->arguments; |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * Returns the arguments for API Request |
|
| 44 | * @method getArguments |
|
| 45 | * @author PA |
|
| 46 | * @date 2017-01-12 |
|
| 47 | * @return array |
|
| 48 | */ |
|
| 49 | ||
| 50 | public function getApiMethodName() : string |
|
| 51 | { |
|
| 52 | return $this->apiMethod; |
|
| 53 | } |
|
| 54 | ||
| 55 | } |
|
| 56 | ||
| @@ 7-37 (lines=31) @@ | ||
| 4 | /** |
|
| 5 | * This is an exception that is thrown when an error occurs with the API responses. |
|
| 6 | */ |
|
| 7 | class YourMembershipResponseException extends YourMembershipException |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * Api Method That is related to this exception |
|
| 11 | * @var string |
|
| 12 | */ |
|
| 13 | private $apiMethod; |
|
| 14 | ||
| 15 | public function __construct(string $message, int $code = 0, string $apiMethod, \Exception $e = null) |
|
| 16 | { |
|
| 17 | $this->apiMethod = $apiMethod; |
|
| 18 | parent::__construct($message, $code, $e); |
|
| 19 | } |
|
| 20 | ||
| 21 | /** |
|
| 22 | * Returns the APi Method Name |
|
| 23 | * @method getApiMethodName |
|
| 24 | * @author PA |
|
| 25 | * @date 2017-01-12 |
|
| 26 | * @return string |
|
| 27 | */ |
|
| 28 | public function getApiMethodName() : string { |
|
| 29 | return $this->apiMethod; |
|
| 30 | } |
|
| 31 | ||
| 32 | public function __toString() |
|
| 33 | { |
|
| 34 | return __CLASS__ . ": [{$this->apiMethod}]: {$this->message}\n"; |
|
| 35 | } |
|
| 36 | ||
| 37 | } |
|
| 38 | ||