Total Complexity | 9 |
Total Lines | 62 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
6 | final class MessageOptions |
||
7 | { |
||
8 | private $subject; |
||
9 | private $htmlTemplate; |
||
10 | private $textTemplate; |
||
11 | private $participants; |
||
12 | |||
13 | 1 | public static function fromArray(array $messageOptions): self |
|
14 | { |
||
15 | 1 | return new self( |
|
16 | 1 | $messageOptions['subject'], |
|
17 | 1 | $messageOptions['html_template'] ?? null, |
|
18 | 1 | $messageOptions['text_template'] ?? null, |
|
19 | 1 | Participants::fromArray($messageOptions['participants']) |
|
20 | ); |
||
21 | } |
||
22 | |||
23 | 1 | public function __construct( |
|
24 | ?string $subject, |
||
25 | ?string $htmlTemplate, |
||
26 | ?string $textTemplate, |
||
27 | Participants $participants |
||
28 | ) { |
||
29 | 1 | $this->subject = $subject; |
|
30 | 1 | $this->htmlTemplate = $htmlTemplate; |
|
31 | 1 | $this->textTemplate = $textTemplate; |
|
32 | 1 | $this->participants = $participants; |
|
33 | 1 | } |
|
34 | |||
35 | 1 | public function getSubject(): ?string |
|
36 | { |
||
37 | 1 | return $this->subject; |
|
38 | } |
||
39 | |||
40 | 1 | public function hasSubject(): bool |
|
41 | { |
||
42 | 1 | return is_string($this->subject); |
|
43 | } |
||
44 | |||
45 | 1 | public function getHtmlTemplate(): ?string |
|
46 | { |
||
47 | 1 | return $this->htmlTemplate; |
|
48 | } |
||
49 | |||
50 | 1 | public function hasHtmlTemplate(): bool |
|
51 | { |
||
52 | 1 | return is_string($this->htmlTemplate); |
|
53 | } |
||
54 | |||
55 | 1 | public function getTextTemplate(): ?string |
|
56 | { |
||
57 | 1 | return $this->textTemplate; |
|
58 | } |
||
59 | |||
60 | 1 | public function hasTextTemplate(): bool |
|
63 | } |
||
64 | |||
65 | 1 | public function getParticipants(): Participants |
|
66 | { |
||
67 | 1 | return $this->participants; |
|
68 | } |
||
69 | } |
||
70 |