| 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 |
|
| 18 |
public function __construct(string $sender, string $receiver, string $replyTo = '') |
| 19 |
{ |
| 20 |
$this->sender = $sender; |
| 21 |
$this->receiver = $receiver; |
| 22 |
$this->replyTo = $replyTo; |
| 23 |
} |
| 24 |
|
| 25 |
public function getSender(): string |
| 26 |
{ |
| 27 |
return $this->sender; |
| 28 |
} |
| 29 |
|
| 30 |
public function getReceiver(): string |
| 31 |
{ |
| 32 |
return $this->receiver; |
| 33 |
} |
| 34 |
|
| 35 |
public function getReplyTo(): string |
| 36 |
{ |
| 37 |
return $this->replyTo; |
| 38 |
} |
| 39 |
|
| 40 |
public function setSender(string $sender): void |
| 41 |
{ |
| 42 |
$this->sender = $sender; |
| 43 |
} |
| 44 |
|
| 45 |
public function setReceiver(string $receiver): void |
| 46 |
{ |
| 47 |
$this->receiver = $receiver; |
| 48 |
} |
| 49 |
|
| 50 |
public function setReplyTo(string $replyTo): void |
| 51 |
{ |
| 52 |
$this->replyTo = $replyTo; |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* Convert contact information to array |
| 57 |
* |
| 58 |
* @return array<string, string> |
| 59 |
*/ |
| 60 |
public function toArray(): array |
| 61 |
{ |
| 62 |
return [ |
| 63 |
'sender' => $this->sender, |
| 64 |
'receiver' => $this->receiver, |
| 65 |
'replyTo' => $this->replyTo, |
| 66 |
]; |
| 67 |
} |
| 68 |
} |
| 69 |
|