| Total Complexity | 4 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Coverage | 86.67% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | class SmsHandler extends AbstractHandler |
||
| 19 | { |
||
| 20 | const API_ENDPOINT = '/rest/sms/send'; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @param string $phoneNumber |
||
| 24 | * @param string $content |
||
| 25 | * @param string $from |
||
| 26 | * @param string $messageId |
||
| 27 | * @param bool $single |
||
| 28 | * @return null |
||
| 29 | */ |
||
| 30 | 77 | public function sendSingleSms( |
|
| 31 | string $phoneNumber, |
||
| 32 | string $content, |
||
| 33 | string $from = '', |
||
| 34 | string $messageId = '', |
||
| 35 | bool $single = false |
||
| 36 | ) { |
||
| 37 | 77 | $getParameters = []; |
|
| 38 | 22 | $postParameters = [ |
|
| 39 | 77 | 'gsm' => $phoneNumber, |
|
| 40 | 77 | 'text' => $content, |
|
| 41 | 'from' => $from ?: null, |
||
| 42 | 77 | 'single' => $single, |
|
| 43 | 'messageId' => $messageId ?: null |
||
| 44 | ]; |
||
| 45 | |||
| 46 | 55 | $postParameters = array_filter($postParameters, function ($value) { |
|
| 47 | 77 | return $value !== null; |
|
| 48 | 77 | }); |
|
| 49 | 77 | $this->processRequest($getParameters, $postParameters); |
|
| 50 | 7 | return null; |
|
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @return string |
||
| 55 | */ |
||
| 56 | 7 | protected function getApiEndpoint(): string |
|
| 59 | } |
||
| 60 | } |
||
| 61 |