| Total Complexity | 4 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class AndroidGsmModem implements IProvider { |
||
| 13 | |||
| 14 | const PROVIDER_ID = 'android_gsm_modem'; |
||
| 15 | |||
| 16 | /** @var IClient */ |
||
| 17 | private $client; |
||
| 18 | |||
| 19 | /** @var AndroidGsmModemConfig */ |
||
| 20 | private $config; |
||
| 21 | |||
| 22 | public function __construct(IClientService $clientService, |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param string $identifier |
||
| 30 | * @param string $message |
||
| 31 | * |
||
| 32 | * @throws SmsTransmissionException |
||
| 33 | */ |
||
| 34 | public function send(string $identifier, string $message) { |
||
| 35 | $config = $this->getConfig(); |
||
| 36 | $user = $config->getUser(); |
||
| 37 | $password = $config->getPassword(); |
||
| 38 | $host = $config->getHost(); |
||
| 39 | $protocol = $config->getProtocol(); |
||
| 40 | try { |
||
| 41 | $this->client->get("$protocol://$host/SendSMS", [ |
||
| 42 | 'query' => [ |
||
| 43 | 'user' => $user, |
||
| 44 | 'password' => $password, |
||
| 45 | 'phone' => $identifier, |
||
| 46 | 'message' => $message, |
||
| 47 | ], |
||
| 48 | ]); |
||
| 49 | } catch (Exception $ex) { |
||
| 50 | throw new SmsTransmissionException(); |
||
| 51 | } |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @return AndroidGsmModemConfig |
||
| 56 | */ |
||
| 57 | public function getConfig(): IProviderConfig { |
||
| 59 | } |
||
| 60 | } |
||
| 61 |