Conditions | 5 |
Paths | 5 |
Total Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
39 | public function send($notifiable, Notification $notification) |
||
40 | { |
||
41 | if (! $to = $notifiable->routeNotificationFor('plivo')) { |
||
42 | return; |
||
43 | } |
||
44 | |||
45 | $message = $notification->toPlivo($notifiable); |
||
46 | |||
47 | if (is_string($message)) { |
||
48 | $message = new PlivoMessage($message); |
||
49 | } |
||
50 | |||
51 | $response = $this->plivo->send_message([ |
||
52 | 'src' => $message->from ?: $this->from, |
||
53 | 'dst' => $to, |
||
54 | 'text' => trim($message->content), |
||
55 | ]); |
||
56 | |||
57 | if ($response['status'] !== 202) { |
||
58 | throw CouldNotSendNotification::serviceRespondedWithAnError($response); |
||
59 | } |
||
60 | |||
61 | return $response; |
||
62 | } |
||
63 | } |
||
64 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.