| Conditions | 3 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | 3 | public function send(PhoneNumberInterface $number, MessageInterface $message, Config $config) |
|
| 22 | { |
||
| 23 | 3 | $signature = $this->config->get('signature'); |
|
| 24 | 3 | $content = $message->getContent($this); |
|
| 25 | 3 | $result = $this->post('/v1/sms/send.json', [ |
|
| 26 | 3 | 'apikey' => $this->config['api_key'], |
|
| 27 | 3 | 'mobile' => $number->getUniversalNumber(), |
|
| 28 | 3 | 'text' => strpos($content, '【') === 0 ? $content : $signature . $content, |
|
| 29 | ]); |
||
| 30 | 3 | if (data_get($result, 'code') === 0) { |
|
| 31 | 3 | return $result; |
|
| 32 | } |
||
| 33 | |||
| 34 | 1 | throw new CouldNotSendNotification(data_get($result, 'msg'), data_get($result, 'code'), $result); |
|
| 35 | } |
||
| 37 |