| 1 |
<?php |
| 2 |
|
| 3 |
namespace IvyForms\ValueObjects\Notification; |
| 4 |
|
| 5 |
use IvyForms\Common\Exceptions\ValidationException; |
| 6 |
|
| 7 |
/** |
| 8 |
* Value Object for Notification Contact Information |
| 9 |
* |
| 10 |
* @package IvyForms\ValueObjects\Notification |
| 11 |
*/ |
| 12 |
final class NotificationContact |
| 13 |
{ |
| 14 |
private string $sender; |
| 15 |
private string $receiver; |
| 16 |
private string $replyTo; |
| 17 |
private string $cc; |
| 18 |
private string $bcc; |
| 19 |
|
| 20 |
public function __construct( |
| 21 |
string $sender, |
| 22 |
string $receiver, |
| 23 |
string $replyTo = '', |
| 24 |
string $cc = '', |
| 25 |
string $bcc = '' |
| 26 |
) { |
| 27 |
$this->sender = $sender; |
| 28 |
$this->receiver = $receiver; |
| 29 |
$this->replyTo = $replyTo; |
| 30 |
$this->cc = $cc; |
| 31 |
$this->bcc = $bcc; |
| 32 |
} |
| 33 |
|
| 34 |
public function getSender(): string |
| 35 |
{ |
| 36 |
return $this->sender; |
| 37 |
} |
| 38 |
|
| 39 |
public function getReceiver(): string |
| 40 |
{ |
| 41 |
return $this->receiver; |
| 42 |
} |
| 43 |
|
| 44 |
public function getReplyTo(): string |
| 45 |
{ |
| 46 |
return $this->replyTo; |
| 47 |
} |
| 48 |
|
| 49 |
public function setSender(string $sender): void |
| 50 |
{ |
| 51 |
$this->sender = $sender; |
| 52 |
} |
| 53 |
|
| 54 |
public function setReceiver(string $receiver): void |
| 55 |
{ |
| 56 |
$this->receiver = $receiver; |
| 57 |
} |
| 58 |
|
| 59 |
public function setReplyTo(string $replyTo): void |
| 60 |
{ |
| 61 |
$this->replyTo = $replyTo; |
| 62 |
} |
| 63 |
|
| 64 |
public function getCc(): string |
| 65 |
{ |
| 66 |
return $this->cc; |
| 67 |
} |
| 68 |
|
| 69 |
public function setCc(string $cc): void |
| 70 |
{ |
| 71 |
$this->cc = $cc; |
| 72 |
} |
| 73 |
|
| 74 |
public function getBcc(): string |
| 75 |
{ |
| 76 |
return $this->bcc; |
| 77 |
} |
| 78 |
|
| 79 |
public function setBcc(string $bcc): void |
| 80 |
{ |
| 81 |
$this->bcc = $bcc; |
| 82 |
} |
| 83 |
|
| 84 |
/** |
| 85 |
* Convert contact information to array |
| 86 |
* |
| 87 |
* @return array<string, string> |
| 88 |
*/ |
| 89 |
public function toArray(): array |
| 90 |
{ |
| 91 |
return [ |
| 92 |
'sender' => $this->sender, |
| 93 |
'receiver' => $this->receiver, |
| 94 |
'replyTo' => $this->replyTo, |
| 95 |
'cc' => $this->cc, |
| 96 |
'bcc' => $this->bcc, |
| 97 |
]; |
| 98 |
} |
| 99 |
} |
| 100 |
|