Total Complexity | 4 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 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 | try { |
||
40 | $this->client->get("http://$host/SendSMS", [ |
||
41 | 'query' => [ |
||
42 | 'user' => $user, |
||
43 | 'password' => $password, |
||
44 | 'phone' => $identifier, |
||
45 | 'message' => $message, |
||
46 | ], |
||
47 | ]); |
||
48 | } catch (Exception $ex) { |
||
49 | throw new SmsTransmissionException(); |
||
50 | } |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @return AndroidGsmModemConfig |
||
55 | */ |
||
56 | public function getConfig(): IProviderConfig { |
||
58 | } |
||
59 | } |
||
60 |