1 | <?php |
||
10 | class JetSmsXmlResponse implements JetSmsResponseInterface |
||
11 | { |
||
12 | /** |
||
13 | * The predefined status codes of the JetSms Xml api. |
||
14 | * |
||
15 | * @var array |
||
16 | */ |
||
17 | protected static $statuses = [ |
||
18 | '00' => 'Success', |
||
19 | '10' => 'Invalid client credentials', |
||
20 | '11' => 'Insufficient funds', |
||
21 | '20' => 'Invalid xml', |
||
22 | '81' => 'Out of limits', |
||
23 | '90' => 'System error', |
||
24 | ]; |
||
25 | |||
26 | /** |
||
27 | * The JetSms Http status code. |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $statusCode; |
||
32 | |||
33 | /** |
||
34 | * The message of the response if any. |
||
35 | * |
||
36 | * @var string|null |
||
37 | */ |
||
38 | protected $message; |
||
39 | |||
40 | /** |
||
41 | * The group identifier. |
||
42 | * |
||
43 | * @var string|null |
||
44 | */ |
||
45 | protected $groupId; |
||
46 | |||
47 | /** |
||
48 | * XmlJetSmsHttpResponse constructor. |
||
49 | * |
||
50 | * @param string $data |
||
51 | */ |
||
52 | 9 | public function __construct($data) |
|
63 | |||
64 | /** |
||
65 | * Determine if the operation was successful or not. |
||
66 | * |
||
67 | * @return bool |
||
68 | */ |
||
69 | 9 | public function isSuccessful() |
|
73 | |||
74 | /** |
||
75 | * Get the message of the response. |
||
76 | * |
||
77 | * @return null|string |
||
78 | */ |
||
79 | 2 | public function message() |
|
83 | |||
84 | /** |
||
85 | * Get the group identifier from the response. |
||
86 | * |
||
87 | * @return string |
||
88 | */ |
||
89 | 1 | public function groupId() |
|
93 | |||
94 | /** |
||
95 | * Get the message report identifiers for the messages sent. |
||
96 | * Message report id returns -1 if invalid Msisdns, -2 if invalid message text. |
||
97 | */ |
||
98 | 1 | public function messageReportIdentifiers() |
|
104 | |||
105 | /** |
||
106 | * Get the status code. |
||
107 | * |
||
108 | * @return string |
||
109 | */ |
||
110 | 2 | public function statusCode() |
|
114 | |||
115 | /** |
||
116 | * Get the string representation of the status. |
||
117 | * |
||
118 | * @return string |
||
119 | */ |
||
120 | 1 | public function status() |
|
126 | } |
||
127 |