| Conditions | 4 |
| Paths | 4 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4.0119 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | 4 | public function send(Notification $notification, Recipient $recipient): void |
|
| 31 | { |
||
| 32 | 4 | if (!$notification instanceof SmsNotification) { |
|
| 33 | return; |
||
| 34 | } |
||
| 35 | |||
| 36 | 4 | if (null === ($recipientPhoneNumber = $recipient->getRecipientContact(self::NAME, $notification))) { |
|
| 37 | 1 | return; |
|
| 38 | } |
||
| 39 | |||
| 40 | 3 | $message = $notification->toSmsMessage($recipient); |
|
| 41 | 3 | $message->to($recipientPhoneNumber); |
|
| 42 | |||
| 43 | try { |
||
| 44 | 3 | $this->texter->send($message); |
|
| 45 | 1 | } catch (SendingMessageFailed $error) { |
|
| 46 | 1 | throw SendingNotificationFailed::dueTo($error, self::NAME); |
|
| 47 | } |
||
| 48 | 2 | } |
|
| 49 | } |
||
| 50 |