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 | 14 | 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 | 12 | public function sendMessage(TwilioMessage $message, $to, $useAlphanumericSender = false) |
|
62 | |||
63 | /** |
||
64 | * Send an sms message using the Twilio Service. |
||
65 | * |
||
66 | * @param TwilioSmsMessage $message |
||
67 | * @param string $to |
||
68 | * @return \Twilio\Rest\Api\V2010\Account\MessageInstance |
||
69 | */ |
||
70 | 9 | protected function sendSmsMessage(TwilioSmsMessage $message, $to) |
|
106 | |||
107 | /** |
||
108 | * Make a call using the Twilio Service. |
||
109 | * |
||
110 | * @param TwilioCallMessage $message |
||
111 | * @param string $to |
||
112 | * @return \Twilio\Rest\Api\V2010\Account\CallInstance |
||
113 | * @throws \Twilio\Exceptions\TwilioException |
||
114 | */ |
||
115 | 2 | protected function makeCall(TwilioCallMessage $message, $to) |
|
140 | |||
141 | /** |
||
142 | * Get the from address from message, or config. |
||
143 | * |
||
144 | * @param TwilioMessage $message |
||
145 | * @return string |
||
146 | */ |
||
147 | 11 | protected function getFrom(TwilioMessage $message) |
|
151 | |||
152 | /** |
||
153 | * Get the messaging service SID from message, or config. |
||
154 | * |
||
155 | * @param TwilioSmsMessage $message |
||
156 | * @return string |
||
157 | */ |
||
158 | 9 | protected function getMessagingServiceSid(TwilioSmsMessage $message) |
|
162 | |||
163 | /** |
||
164 | * Get the alphanumeric sender from config, if one exists. |
||
165 | * |
||
166 | * @return string|null |
||
167 | */ |
||
168 | 2 | protected function getAlphanumericSender() |
|
174 | |||
175 | /** |
||
176 | * @param array $params |
||
177 | * @param TwilioMessage $message |
||
178 | * @param array $optionalParams |
||
179 | * @return Twilio |
||
180 | */ |
||
181 | 10 | protected function fillOptionalParams(&$params, $message, $optionalParams) |
|
191 | } |
||
192 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: