1 | <?php |
||
10 | final class JetSmsHttpResponse implements JetSmsResponseInterface |
||
11 | { |
||
12 | /** |
||
13 | * The read response of SMS message request.. |
||
14 | * |
||
15 | * @var array |
||
16 | */ |
||
17 | private $responseAttributes = []; |
||
18 | |||
19 | /** |
||
20 | * The JetSMS error codes. |
||
21 | * |
||
22 | * @var array |
||
23 | */ |
||
24 | private static $statuses = [ |
||
25 | '0' => 'Success', |
||
26 | '-1' => 'The specified SMS outbox name is invalid', |
||
27 | '-5' => 'The SMS service credentials are incorrect', |
||
28 | '-6' => 'The specified data is malformed', |
||
29 | '-7' => 'The send date of the SMS message has already expired', |
||
30 | '-8' => 'The SMS gsm number is invalid', |
||
31 | '-9' => 'The SMS message body is missing', |
||
32 | '-15' => 'The SMS service is having some trouble at the moment', |
||
33 | '-99' => 'The SMS service encountered an unexpected error', |
||
34 | ]; |
||
35 | |||
36 | /** |
||
37 | * Create a message response. |
||
38 | * |
||
39 | * @param string $responseBody |
||
40 | */ |
||
41 | public function __construct($responseBody) |
||
45 | |||
46 | /** |
||
47 | * Determine if the operation was successful or not. |
||
48 | * |
||
49 | * @return bool |
||
50 | */ |
||
51 | public function isSuccessful() |
||
55 | |||
56 | /** |
||
57 | * Get the status code. |
||
58 | * |
||
59 | * @return string |
||
60 | */ |
||
61 | public function statusCode() |
||
65 | |||
66 | /** |
||
67 | * Get the string representation of the status. |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | public function status() |
||
77 | |||
78 | /** |
||
79 | * Get the message of the response. |
||
80 | * |
||
81 | * @return null|string |
||
82 | */ |
||
83 | public function message() |
||
87 | |||
88 | /** |
||
89 | * Get the group identifier from the response. |
||
90 | */ |
||
91 | public function groupId() |
||
97 | |||
98 | /** |
||
99 | * Get the message report identifiers for the messages sent. |
||
100 | * Message report id returns -1 if invalid Msisdns, -2 if invalid message text. |
||
101 | * |
||
102 | * @return array |
||
103 | */ |
||
104 | public function messageReportIdentifiers() |
||
112 | |||
113 | /** |
||
114 | * Read the message response body string. |
||
115 | * |
||
116 | * @param $responseBodyString |
||
117 | * @return array |
||
118 | */ |
||
119 | private function readResponseBodyString($responseBodyString) |
||
138 | } |
||
139 |