1 | <?php |
||
13 | class SmslabsClient |
||
14 | { |
||
15 | const SEND_SMS_URL = '/sendSms'; |
||
16 | const SENDERS_URL = '/senders'; |
||
17 | const SMS_STATUS_URL = '/smsStatus'; |
||
18 | const SMS_LIST_URL = '/sms'; |
||
19 | const SMS_IN_URL = '/smsIn'; |
||
20 | const ACCOUNT_URL = '/account'; |
||
21 | |||
22 | /** |
||
23 | * @var HttpClient |
||
24 | */ |
||
25 | private $client; |
||
26 | |||
27 | /** |
||
28 | * @var bool |
||
29 | */ |
||
30 | private $isFlashMessage = false; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | private $senderId; |
||
36 | |||
37 | /** |
||
38 | * @var int |
||
39 | */ |
||
40 | private $expirationMinutes = 0; |
||
41 | |||
42 | /** |
||
43 | * @var \DateTime |
||
44 | */ |
||
45 | private $sendDateTime; |
||
46 | |||
47 | /** |
||
48 | * @var array[] |
||
49 | */ |
||
50 | private $smsToSend = []; |
||
51 | |||
52 | /** |
||
53 | * @var SmsSentResponse[] |
||
54 | */ |
||
55 | private $smsStatus = []; |
||
56 | |||
57 | /** |
||
58 | * Smslabs constructor. |
||
59 | * @param string $appKey |
||
60 | * @param string $secretKey |
||
61 | */ |
||
62 | public function __construct($appKey, $secretKey) |
||
66 | |||
67 | /** |
||
68 | * @param HttpClient $client |
||
69 | */ |
||
70 | public function setClient($client) |
||
74 | |||
75 | /** |
||
76 | * @param boolean $isFlashMessage |
||
77 | * @return SmslabsClient $this |
||
78 | */ |
||
79 | public function setIsFlashMessage($isFlashMessage) |
||
85 | |||
86 | /** |
||
87 | * @param string $senderId |
||
88 | * @return SmslabsClient $this |
||
89 | */ |
||
90 | public function setSenderId($senderId) |
||
96 | |||
97 | /** |
||
98 | * @param int $expirationMinutes |
||
99 | * @return SmslabsClient $this |
||
100 | */ |
||
101 | public function setExpiration($expirationMinutes) |
||
111 | |||
112 | /** |
||
113 | * @param \DateTime $sendDateTime |
||
114 | * @return SmslabsClient $this |
||
115 | */ |
||
116 | public function setSendDate(\DateTime $sendDateTime) |
||
122 | |||
123 | /** |
||
124 | * @param string $phoneNumber |
||
125 | * @param string $message |
||
126 | * @param bool $isFlashMessage |
||
127 | * @param int $expirationMinutes |
||
128 | * @param \DateTime $sendDateTime |
||
129 | * @return SmslabsClient $this |
||
130 | */ |
||
131 | public function add( |
||
160 | |||
161 | /** |
||
162 | * @param string $phoneNumber |
||
163 | * @return bool |
||
164 | */ |
||
165 | private function checkPhoneNumber($phoneNumber) |
||
169 | |||
170 | /** |
||
171 | * @return SmslabsClient $this |
||
172 | */ |
||
173 | public function send() |
||
193 | |||
194 | /** |
||
195 | * @return SmsSentResponse[] |
||
196 | */ |
||
197 | public function getSentStatus() |
||
201 | |||
202 | /** |
||
203 | * @return Sender[] |
||
204 | */ |
||
205 | public function getAvailableSenders() |
||
217 | |||
218 | /** |
||
219 | * @return AccountBalance |
||
220 | */ |
||
221 | public function getAccountBalance() |
||
227 | |||
228 | /** |
||
229 | * @return SmsIn[] |
||
230 | */ |
||
231 | public function getSmsIn() |
||
243 | |||
244 | /** |
||
245 | * @param int $offset |
||
246 | * @param int $limit |
||
247 | * @return SmsOut[] |
||
248 | */ |
||
249 | public function getSmsOut($offset = 0, $limit = 100) |
||
261 | |||
262 | /** |
||
263 | * @param string $smsId |
||
264 | * @return SmsDetails |
||
265 | */ |
||
266 | public function getSmsDetails($smsId) |
||
278 | |||
279 | /** |
||
280 | * @return array[] |
||
281 | */ |
||
282 | public function getSmsQueue() |
||
286 | } |
||
287 |