1 | <?php |
||
9 | class Twilio |
||
10 | { |
||
11 | /** |
||
12 | * @var TwilioService |
||
13 | */ |
||
14 | protected $twilioService; |
||
15 | |||
16 | /** |
||
17 | * @var TwilioConfig |
||
18 | */ |
||
19 | private $config; |
||
20 | |||
21 | /** |
||
22 | * Twilio constructor. |
||
23 | * |
||
24 | * @param TwilioService $twilioService |
||
25 | * @param TwilioConfig $config |
||
26 | */ |
||
27 | 13 | public function __construct(TwilioService $twilioService, TwilioConfig $config) |
|
32 | |||
33 | /** |
||
34 | * Send a TwilioMessage to the a phone number. |
||
35 | * |
||
36 | * @param TwilioMessage $message |
||
37 | * @param string $to |
||
38 | * @param bool $useAlphanumericSender |
||
39 | * @return object|null |
||
40 | * @throws \Twilio\Exceptions\TwilioException |
||
41 | */ |
||
42 | 11 | public function sendMessage(TwilioMessage $message, $to, $useAlphanumericSender = false) |
|
67 | |||
68 | /** |
||
69 | * Send an sms message using the Twilio Service. |
||
70 | * |
||
71 | * @param TwilioSmsMessage $message |
||
72 | * @param string $to |
||
73 | * @return \Twilio\Rest\Api\V2010\Account\MessageInstance |
||
74 | */ |
||
75 | 8 | protected function sendSmsMessage(TwilioSmsMessage $message, $to) |
|
110 | |||
111 | /** |
||
112 | * Make a call using the Twilio Service. |
||
113 | * |
||
114 | * @param TwilioCallMessage $message |
||
115 | * @param string $to |
||
116 | * @return \Twilio\Rest\Api\V2010\Account\CallInstance |
||
117 | * @throws \Twilio\Exceptions\TwilioException |
||
118 | */ |
||
119 | 2 | protected function makeCall(TwilioCallMessage $message, $to) |
|
144 | |||
145 | /** |
||
146 | * Get the from address from message, or config. |
||
147 | * |
||
148 | * @param TwilioMessage $message |
||
149 | * @return string |
||
150 | */ |
||
151 | 10 | protected function getFrom(TwilioMessage $message) |
|
155 | |||
156 | /** |
||
157 | * Get the messaging service SID from message, or config. |
||
158 | * |
||
159 | * @param TwilioSmsMessage $message |
||
160 | * @return string |
||
161 | */ |
||
162 | 8 | protected function getMessagingServiceSid(TwilioSmsMessage $message) |
|
166 | |||
167 | /** |
||
168 | * Get the alphanumeric sender from config, if one exists. |
||
169 | * |
||
170 | * @return string|null |
||
171 | */ |
||
172 | 2 | protected function getAlphanumericSender() |
|
178 | |||
179 | /** |
||
180 | * @param array $params |
||
181 | * @param TwilioMessage $message |
||
182 | * @param array $optionalParams |
||
183 | * @return Twilio |
||
184 | */ |
||
185 | 9 | protected function fillOptionalParams(&$params, $message, $optionalParams) |
|
195 | } |
||
196 |