1 | <?php |
||
14 | class SmslabsClient |
||
15 | { |
||
16 | const SEND_SMS_URL = '/sendSms'; |
||
17 | const SENDERS_URL = '/senders'; |
||
18 | const SMS_STATUS_URL = '/smsStatus'; |
||
19 | const SMS_LIST_URL = '/sms'; |
||
20 | const SMS_IN_URL = '/smsIn'; |
||
21 | const ACCOUNT_URL = '/account'; |
||
22 | |||
23 | /** |
||
24 | * @var HttpClient |
||
25 | */ |
||
26 | private $client; |
||
27 | |||
28 | /** |
||
29 | * @var int |
||
30 | */ |
||
31 | private $isFlashMessage = 0; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | private $senderId; |
||
37 | |||
38 | /** |
||
39 | * @var int |
||
40 | */ |
||
41 | private $expirationMinutes = 0; |
||
42 | |||
43 | /** |
||
44 | * @var \DateTime |
||
45 | */ |
||
46 | private $sendDateTime; |
||
47 | |||
48 | /** |
||
49 | * @var array[] |
||
50 | */ |
||
51 | private $smsToSend = []; |
||
52 | |||
53 | /** |
||
54 | * @var SmsSentResponse[] |
||
55 | */ |
||
56 | private $smsStatus = []; |
||
57 | |||
58 | /** |
||
59 | * Smslabs constructor. |
||
60 | * @param string $appKey |
||
61 | * @param string $secretKey |
||
62 | */ |
||
63 | 18 | public function __construct(string $appKey, string $secretKey) |
|
67 | |||
68 | /** |
||
69 | * @return HttpClient |
||
70 | */ |
||
71 | 1 | public function getClient() : HttpClient |
|
75 | |||
76 | /** |
||
77 | * @param HttpClient $client |
||
78 | * @return SmslabsClient $this |
||
79 | */ |
||
80 | 7 | public function setClient(HttpClient $client) : SmslabsClient |
|
86 | |||
87 | /** |
||
88 | * @return int |
||
89 | */ |
||
90 | 1 | public function isFlashMessage() : int |
|
94 | |||
95 | /** |
||
96 | * @param int $isFlashMessage |
||
97 | * @return SmslabsClient $this |
||
98 | */ |
||
99 | 2 | public function setFlashMessage(int $isFlashMessage) : SmslabsClient |
|
105 | |||
106 | /** |
||
107 | * @return string |
||
108 | */ |
||
109 | 1 | public function getSenderId() : string |
|
113 | |||
114 | /** |
||
115 | * @param string $senderId |
||
116 | * @return SmslabsClient $this |
||
117 | */ |
||
118 | 6 | public function setSenderId(string $senderId) : SmslabsClient |
|
124 | |||
125 | /** |
||
126 | * @return int |
||
127 | */ |
||
128 | 3 | public function getExpirationMinutes() : int |
|
132 | |||
133 | /** |
||
134 | * @param int $expirationMinutes |
||
135 | * @return SmslabsClient $this |
||
136 | */ |
||
137 | 6 | public function setExpirationMinutes(int $expirationMinutes) : SmslabsClient |
|
147 | |||
148 | /** |
||
149 | * @return \DateTime |
||
150 | */ |
||
151 | 1 | public function getSendDateTime() : \DateTime |
|
155 | |||
156 | /** |
||
157 | * @param \DateTime $sendDateTime |
||
158 | * @return SmslabsClient $this |
||
159 | */ |
||
160 | 2 | public function setSendDateTime(\DateTime $sendDateTime) : SmslabsClient |
|
166 | |||
167 | /** |
||
168 | * @param string $phoneNumber |
||
169 | * @param string $message |
||
170 | * @param bool $isFlashMessage |
||
171 | * @param int $expirationMinutes |
||
172 | * @param \DateTime $sendDateTime |
||
173 | * @return SmslabsClient $this |
||
174 | */ |
||
175 | 6 | public function add( |
|
204 | |||
205 | /** |
||
206 | * @param string $phoneNumber |
||
207 | * @return bool |
||
208 | */ |
||
209 | 6 | private function checkPhoneNumber(string $phoneNumber) : bool |
|
213 | |||
214 | /** |
||
215 | * @return SmslabsClient $this |
||
216 | */ |
||
217 | 3 | public function send() : SmslabsClient |
|
237 | |||
238 | /** |
||
239 | * @return SmsSentResponse[] |
||
240 | */ |
||
241 | 1 | public function getSentStatus() : array |
|
245 | |||
246 | /** |
||
247 | * @return Sender[] |
||
248 | */ |
||
249 | 1 | public function getAvailableSenders() : array |
|
261 | |||
262 | /** |
||
263 | * @return AccountBalance |
||
264 | */ |
||
265 | 1 | public function getAccountBalance() : AccountBalance |
|
271 | |||
272 | /** |
||
273 | * @return SmsIn[] |
||
274 | */ |
||
275 | 1 | public function getSmsIn() : array |
|
287 | |||
288 | /** |
||
289 | * @param int $offset |
||
290 | * @param int $limit |
||
291 | * @return SmsOut[] |
||
292 | */ |
||
293 | 1 | public function getSmsOut(int $offset = 0, int $limit = 100) : array |
|
305 | |||
306 | /** |
||
307 | * @param string $smsId |
||
308 | * @return bool |
||
309 | */ |
||
310 | 2 | private function isValidSmsId(string $smsId) : bool |
|
314 | |||
315 | /** |
||
316 | * @param string $smsId |
||
317 | * @return SmsDetails |
||
318 | */ |
||
319 | 2 | public function getSmsDetails(string $smsId) : SmsDetails |
|
331 | |||
332 | /** |
||
333 | * @return array[] |
||
334 | */ |
||
335 | 3 | public function getSmsQueue() : array |
|
339 | } |
||
340 |