Conditions | 4 |
Paths | 8 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4.5923 |
Changes | 4 | ||
Bugs | 1 | Features | 2 |
1 | <?php |
||
30 | 1 | public function send(MessagebirdMessage $message) |
|
31 | { |
||
32 | 1 | if (empty($message->originator)) { |
|
33 | $message->setOriginator(config('services.messagebird.originator')); |
||
34 | } |
||
35 | 1 | if (empty($message->recipients)) { |
|
36 | $message->setRecipients(config('services.messagebird.recipients')); |
||
37 | } |
||
38 | |||
39 | try { |
||
40 | 1 | $this->client->request('POST', 'http://rest.messagebird.com/messages', [ |
|
41 | 1 | 'body' => $message->toJson(), |
|
42 | 'headers' => [ |
||
43 | 1 | 'Authorization' => 'AccessKey '.$this->access_key |
|
44 | 1 | ], |
|
45 | 1 | ]); |
|
46 | 1 | } catch (Exception $exception) { |
|
47 | throw CouldNotSendNotification::serviceRespondedWithAnError($exception); |
||
48 | } |
||
49 | 1 | } |
|
50 | } |
||
51 |