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 | 8 | public function __construct($appKey, $secretKey) |
|
66 | |||
67 | /** |
||
68 | * @return HttpClient |
||
69 | */ |
||
70 | 1 | public function getClient() |
|
74 | |||
75 | /** |
||
76 | * @param HttpClient $client |
||
77 | */ |
||
78 | 2 | public function setClient($client) |
|
82 | |||
83 | /** |
||
84 | * @return boolean |
||
85 | */ |
||
86 | 1 | public function isIsFlashMessage() |
|
90 | |||
91 | /** |
||
92 | * @param boolean $isFlashMessage |
||
93 | * @return SmslabsClient $this |
||
94 | */ |
||
95 | 1 | public function setIsFlashMessage($isFlashMessage) |
|
101 | |||
102 | /** |
||
103 | * @return string |
||
104 | */ |
||
105 | 1 | public function getSenderId() |
|
109 | |||
110 | /** |
||
111 | * @param string $senderId |
||
112 | * @return SmslabsClient $this |
||
113 | */ |
||
114 | 6 | public function setSenderId($senderId) |
|
120 | |||
121 | /** |
||
122 | * @return int |
||
123 | */ |
||
124 | 1 | public function getExpirationMinutes() |
|
128 | |||
129 | /** |
||
130 | * @param int $expirationMinutes |
||
131 | * @return SmslabsClient $this |
||
132 | */ |
||
133 | 2 | public function setExpirationMinutes($expirationMinutes) |
|
143 | |||
144 | /** |
||
145 | * @return \DateTime |
||
146 | */ |
||
147 | 1 | public function getSendDateTime() |
|
151 | |||
152 | /** |
||
153 | * @param \DateTime $sendDateTime |
||
154 | * @return SmslabsClient $this |
||
155 | */ |
||
156 | 1 | public function setSendDateTime(\DateTime $sendDateTime) |
|
162 | |||
163 | /** |
||
164 | * @param string $phoneNumber |
||
165 | * @param string $message |
||
166 | * @param bool $isFlashMessage |
||
167 | * @param int $expirationMinutes |
||
168 | * @param \DateTime $sendDateTime |
||
169 | * @return SmslabsClient $this |
||
170 | */ |
||
171 | 6 | public function add( |
|
200 | |||
201 | /** |
||
202 | * @param string $phoneNumber |
||
203 | * @return bool |
||
204 | */ |
||
205 | 6 | private function checkPhoneNumber($phoneNumber) |
|
209 | |||
210 | /** |
||
211 | * @return SmslabsClient $this |
||
212 | */ |
||
213 | 3 | public function send() |
|
233 | |||
234 | /** |
||
235 | * @return SmsSentResponse[] |
||
236 | */ |
||
237 | 1 | public function getSentStatus() |
|
241 | |||
242 | /** |
||
243 | * @return Sender[] |
||
244 | */ |
||
245 | public function getAvailableSenders() |
||
257 | |||
258 | /** |
||
259 | * @return AccountBalance |
||
260 | */ |
||
261 | public function getAccountBalance() |
||
267 | |||
268 | /** |
||
269 | * @return SmsIn[] |
||
270 | */ |
||
271 | public function getSmsIn() |
||
283 | |||
284 | /** |
||
285 | * @param int $offset |
||
286 | * @param int $limit |
||
287 | * @return SmsOut[] |
||
288 | */ |
||
289 | public function getSmsOut($offset = 0, $limit = 100) |
||
301 | |||
302 | /** |
||
303 | * @param string $smsId |
||
304 | * @return SmsDetails |
||
305 | */ |
||
306 | public function getSmsDetails($smsId) |
||
318 | |||
319 | /** |
||
320 | * @return array[] |
||
321 | */ |
||
322 | 3 | public function getSmsQueue() |
|
326 | } |
||
327 |