Conditions | 2 |
Paths | 2 |
Total Lines | 24 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
21 | public function dispatch(MessageInterface $message) |
||
22 | { |
||
23 | // Get the dispatch and message data from the message. |
||
24 | $dispatchData = $message->getDispatchData(); |
||
25 | $messageData = $message->getMessageData(); |
||
26 | |||
27 | if (empty($this->client)) { |
||
28 | $credentials = new Client\Credentials\Basic( |
||
29 | $this->nexmoConfiguration['api_key'], |
||
30 | $this->nexmoConfiguration['api_secret'] |
||
31 | ); |
||
32 | $this->client = new Client($credentials); |
||
33 | } |
||
34 | |||
35 | $sent = $this->client->message()->send( |
||
36 | [ |
||
37 | 'to' => $dispatchData['to'], |
||
38 | 'from' => $dispatchData['from'], |
||
39 | 'text' => $messageData['body'], |
||
40 | ] |
||
41 | ); |
||
42 | |||
43 | return ! empty($sent); |
||
44 | } |
||
45 | } |