Conditions | 3 |
Paths | 4 |
Total Lines | 34 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
26 | public function send(SnsMessage $message, $destination) |
||
27 | 3 | { |
|
28 | $attributes = [ |
||
29 | 'AWS.SNS.SMS.SMSType' => [ |
||
30 | 'DataType' => 'String', |
||
31 | 3 | 'StringValue' => $message->getDeliveryType(), |
|
32 | 3 | ], |
|
33 | ]; |
||
34 | |||
35 | if (! empty($message->getSender())) { |
||
36 | 3 | $attributes += [ |
|
37 | 'AWS.SNS.SMS.SenderID' => [ |
||
38 | 'DataType' => 'String', |
||
39 | 1 | 'StringValue' => $message->getSender(), |
|
40 | 1 | ], |
|
41 | ]; |
||
42 | } |
||
43 | |||
44 | if (! empty($message->getOriginationNumber())) { |
||
45 | $attributes += [ |
||
46 | 3 | 'AWS.MM.SMS.OriginationNumber' => [ |
|
47 | 3 | 'DataType' => 'String', |
|
48 | 3 | 'StringValue' => $message->getOriginationNumber(), |
|
49 | ], |
||
50 | ]; |
||
51 | 3 | } |
|
52 | |||
53 | $parameters = [ |
||
54 | 'Message' => $message->getBody(), |
||
55 | 'PhoneNumber' => $destination, |
||
56 | 'MessageAttributes' => $attributes, |
||
57 | ]; |
||
58 | |||
59 | return $this->snsService->publish($parameters); |
||
60 | } |
||
62 |