Total Complexity | 8 |
Total Lines | 68 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
10 | class SmsMessage |
||
11 | { |
||
12 | /** @var string */ |
||
13 | protected $message; |
||
14 | |||
15 | /** @var RequestType */ |
||
16 | protected $requestType; |
||
17 | |||
18 | /** @var string[] */ |
||
19 | protected $recipients = []; |
||
20 | |||
21 | /** @var string|null */ |
||
22 | protected $sender; |
||
23 | |||
24 | /** @var int|null */ |
||
25 | protected $customId; |
||
26 | |||
27 | /** |
||
28 | * @param string[] $recipients |
||
29 | */ |
||
30 | 3 | public function __construct( |
|
31 | string $message, |
||
32 | array $recipients, |
||
33 | ?RequestType $requestTypeHigh = null, |
||
34 | ?string $sender = null, |
||
35 | ?int $customId = null |
||
36 | ) { |
||
37 | 3 | if (count($recipients) === 0) { |
|
38 | 1 | throw new NoRecipientsProvided(); |
|
39 | } |
||
40 | |||
41 | 2 | $this->message = $message; |
|
42 | |||
43 | 2 | if ($requestTypeHigh === null) { |
|
44 | 1 | $requestTypeHigh = RequestType::getRequestTypeHigh(); |
|
45 | } |
||
46 | 2 | $this->requestType = $requestTypeHigh; |
|
47 | 2 | $this->sender = $sender; |
|
48 | 2 | $this->customId = $customId; |
|
49 | 2 | $this->recipients = $recipients; |
|
50 | 2 | } |
|
51 | |||
52 | 2 | public function getMessage() : string |
|
55 | } |
||
56 | |||
57 | 2 | public function getRequestType() : RequestType |
|
58 | { |
||
59 | 2 | return $this->requestType; |
|
60 | } |
||
61 | |||
62 | /** |
||
63 | * @return string[] |
||
64 | */ |
||
65 | 2 | public function getRecipients() : array |
|
66 | { |
||
67 | 2 | return $this->recipients; |
|
68 | } |
||
69 | |||
70 | 2 | public function getSender() : ?string |
|
73 | } |
||
74 | |||
75 | 2 | public function getCustomId() : ?int |
|
78 | } |
||
79 | } |
||
80 |