| Total Complexity | 12 |
| Total Lines | 99 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | class SnsMessage |
||
| 6 | { |
||
| 7 | const PROMOTIONAL_SMS_TYPE = 'Promotional'; |
||
| 8 | |||
| 9 | const TRANSACTIONAL_SMS_TYPE = 'Transactional'; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * The default delivery type for the SMS message. |
||
| 13 | * |
||
| 14 | * @var bool |
||
| 15 | */ |
||
| 16 | protected $promotional = true; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * The body of the message. |
||
| 20 | * |
||
| 21 | * @var string |
||
| 22 | */ |
||
| 23 | protected $body = ''; |
||
| 24 | |||
| 25 | 13 | public function __construct($content) |
|
| 35 | } |
||
| 36 | } |
||
| 37 | } |
||
| 38 | 13 | } |
|
| 39 | |||
| 40 | /** |
||
| 41 | * Creates a new instance of the message. |
||
| 42 | * |
||
| 43 | * @return SnsMessage |
||
| 44 | */ |
||
| 45 | 6 | public static function create(array $data = []) |
|
| 46 | { |
||
| 47 | 6 | return new self($data); |
|
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Sets the message body. |
||
| 52 | * |
||
| 53 | * @return $this |
||
| 54 | */ |
||
| 55 | 10 | public function body(string $content) |
|
| 56 | { |
||
| 57 | 10 | $this->body = trim($content); |
|
| 58 | |||
| 59 | 10 | return $this; |
|
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Get the message body. |
||
| 64 | * |
||
| 65 | * @return string |
||
| 66 | */ |
||
| 67 | 7 | public function getBody() |
|
| 70 | } |
||
| 71 | |||
| 72 | /** |
||
| 73 | * Get the SMS delivery type. |
||
| 74 | * |
||
| 75 | * @return string |
||
| 76 | */ |
||
| 77 | 6 | public function getDeliveryType() |
|
| 80 | } |
||
| 81 | |||
| 82 | /** |
||
| 83 | * Sets the SMS delivery type as promotional. |
||
| 84 | * |
||
| 85 | * @return $this |
||
| 86 | */ |
||
| 87 | 1 | public function promotional(bool $active = true) |
|
| 92 | } |
||
| 93 | |||
| 94 | /** |
||
| 95 | * Sets the SMS delivery type as transactional. |
||
| 96 | * |
||
| 97 | * @return $this |
||
| 98 | */ |
||
| 99 | 3 | public function transactional(bool $active = true) |
|
| 106 |