1 | <?php declare(strict_types=1); |
||
15 | class Response |
||
16 | { |
||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | private $status; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private $code; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $errorMessage; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | private $messageId; |
||
36 | |||
37 | /** |
||
38 | * @param string $rawResponse |
||
39 | * |
||
40 | * @throws EmptyResponseException |
||
41 | * @throws UnknownErrorResponseException |
||
42 | */ |
||
43 | 8 | public function __construct(string $rawResponse) |
|
88 | |||
89 | /** |
||
90 | * Gets the status. |
||
91 | * |
||
92 | * @return string |
||
93 | */ |
||
94 | 1 | public function getStatus(): string |
|
98 | |||
99 | /** |
||
100 | * Whether the response is successful or not. |
||
101 | * |
||
102 | * @return bool |
||
103 | */ |
||
104 | 6 | public function isSuccessful(): bool |
|
108 | |||
109 | /** |
||
110 | * Gets the code. |
||
111 | * |
||
112 | * @return string|null |
||
113 | */ |
||
114 | public function getCode() |
||
118 | |||
119 | /** |
||
120 | * Gets the error message. |
||
121 | * |
||
122 | * @return string|null |
||
123 | */ |
||
124 | public function getErrorMessage() |
||
128 | |||
129 | /** |
||
130 | * Gets the message id. |
||
131 | * |
||
132 | * @return string|null |
||
133 | */ |
||
134 | public function getMessageId() |
||
138 | |||
139 | public function __toString(): string |
||
143 | } |
||
144 |