| Conditions | 6 |
| Paths | 16 |
| Total Lines | 18 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 20 | public function send($message) { |
||
| 21 | if (empty($message->originator)) { |
||
| 22 | $message->setOriginator(config('services.messagebird.originator')); |
||
| 23 | } |
||
| 24 | if (empty($message->recipients)) { |
||
| 25 | $message->setRecipients(config('services.messagebird.recipients')); |
||
| 26 | } |
||
| 27 | |||
| 28 | try { |
||
| 29 | $this->client->messages->create($message); |
||
| 30 | } catch (AuthenticateException $exception) { |
||
| 31 | throw CouldNotSendNotification::couldNotAuthenticate(); |
||
| 32 | } catch (BalanceException $exception) { |
||
| 33 | throw CouldNotSendNotification::notEnoughCredits(); |
||
| 34 | } catch (Exception $exception) { |
||
| 35 | throw CouldNotSendNotification::serviceRespondedWithAnError($exception); |
||
| 36 | } |
||
| 37 | } |
||
| 38 | } |
||
| 39 |