1 | <?php |
||
8 | class Twilio |
||
9 | { |
||
10 | /** |
||
11 | * @var TwilioService |
||
12 | */ |
||
13 | protected $twilioService; |
||
14 | |||
15 | /** |
||
16 | * @var TwilioConfig |
||
17 | */ |
||
18 | private $config; |
||
19 | |||
20 | /** |
||
21 | * Twilio constructor. |
||
22 | * |
||
23 | * @param TwilioService $twilioService |
||
24 | * @param TwilioConfig $config |
||
25 | */ |
||
26 | public function __construct(TwilioService $twilioService, TwilioConfig $config) |
||
31 | |||
32 | /** |
||
33 | * Send a TwilioMessage to the a phone number. |
||
34 | * |
||
35 | * @param TwilioMessage $message |
||
36 | * @param string $to |
||
37 | * @param bool $useAlphanumericSender |
||
38 | * @return mixed |
||
39 | * @throws \Twilio\Exceptions\TwilioException |
||
40 | */ |
||
41 | public function sendMessage(TwilioMessage $message, $to, $useAlphanumericSender = false) |
||
57 | |||
58 | /** |
||
59 | * Send an sms message using the Twilio Service. |
||
60 | * |
||
61 | * @param TwilioSmsMessage $message |
||
62 | * @param string $to |
||
63 | * @return \Twilio\Rest\Api\V2010\Account\MessageInstance |
||
64 | */ |
||
65 | protected function sendSmsMessage(TwilioSmsMessage $message, $to) |
||
100 | |||
101 | /** |
||
102 | * Make a call using the Twilio Service. |
||
103 | * |
||
104 | * @param TwilioCallMessage $message |
||
105 | * @param string $to |
||
106 | * @return \Twilio\Rest\Api\V2010\Account\CallInstance |
||
107 | * @throws \Twilio\Exceptions\TwilioException |
||
108 | */ |
||
109 | protected function makeCall(TwilioCallMessage $message, $to) |
||
134 | |||
135 | /** |
||
136 | * Get the from address from message, or config. |
||
137 | * |
||
138 | * @param TwilioMessage $message |
||
139 | * @return string |
||
140 | */ |
||
141 | protected function getFrom(TwilioMessage $message) |
||
145 | |||
146 | /** |
||
147 | * Get the messaging service SID from message, or config. |
||
148 | * |
||
149 | * @param TwilioSmsMessage $message |
||
150 | * @return string |
||
151 | */ |
||
152 | protected function getMessagingServiceSid(TwilioSmsMessage $message) |
||
156 | |||
157 | /** |
||
158 | * Get the alphanumeric sender from config, if one exists. |
||
159 | * |
||
160 | * @return string|null |
||
161 | */ |
||
162 | protected function getAlphanumericSender() |
||
168 | |||
169 | /** |
||
170 | * @param array $params |
||
171 | * @param TwilioMessage $message |
||
172 | * @param array $optionalParams |
||
173 | * @return Twilio |
||
174 | */ |
||
175 | protected function fillOptionalParams(&$params, $message, $optionalParams) |
||
185 | } |
||
186 |