|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | +* This file is part of the Symfony package. |
| 5 | +* |
| 6 | +* (c) Fabien Potencier <[email protected]> |
| 7 | +* |
| 8 | +* For the full copyright and license information, please view the LICENSE |
| 9 | +* file that was distributed with this source code. |
| 10 | +*/ |
| 11 | + |
| 12 | +namespace Symfony\Component\Notifier\Bridge\MessageMedia; |
| 13 | + |
| 14 | +use Symfony\Component\Notifier\Message\MessageOptionsInterface; |
| 15 | + |
| 16 | +/** |
| 17 | +* @author gnito-org <https://.com/gnito-org> |
| 18 | +*/ |
| 19 | +final class MessageMediaOptions implements MessageOptionsInterface |
| 20 | +{ |
| 21 | +private array $options; |
| 22 | + |
| 23 | +public function __construct(array $options = []) |
| 24 | +{ |
| 25 | +$this->options = $options; |
| 26 | +} |
| 27 | + |
| 28 | +public function getCallbackUrl(): ?string |
| 29 | +{ |
| 30 | +return $this->options['callback_url'] ?? null; |
| 31 | +} |
| 32 | + |
| 33 | +public function getDeliveryReport(): ?bool |
| 34 | +{ |
| 35 | +return $this->options['delivery_report'] ?? null; |
| 36 | +} |
| 37 | + |
| 38 | +public function getFormat(): ?string |
| 39 | +{ |
| 40 | +return $this->options['format'] ?? null; |
| 41 | +} |
| 42 | + |
| 43 | +public function getFrom(): ?string |
| 44 | +{ |
| 45 | +return $this->options['from'] ?? null; |
| 46 | +} |
| 47 | + |
| 48 | +public function getMedia(): ?array |
| 49 | +{ |
| 50 | +return $this->options['media'] ?? null; |
| 51 | +} |
| 52 | + |
| 53 | +public function getMessageExpiryTimestamp(): ?int |
| 54 | +{ |
| 55 | +return $this->options['message_expiry_timestamp'] ?? null; |
| 56 | +} |
| 57 | + |
| 58 | +public function getMetadata(): ?array |
| 59 | +{ |
| 60 | +return $this->options['metadata'] ?? null; |
| 61 | +} |
| 62 | + |
| 63 | +public function getRecipientId(): ?string |
| 64 | +{ |
| 65 | +return $this->options['recipient_id'] ?? null; |
| 66 | +} |
| 67 | + |
| 68 | +public function getScheduled(): ?string |
| 69 | +{ |
| 70 | +return $this->options['scheduled'] ?? null; |
| 71 | +} |
| 72 | + |
| 73 | +public function getSubject(): ?string |
| 74 | +{ |
| 75 | +return $this->options['subject'] ?? null; |
| 76 | +} |
| 77 | + |
| 78 | +public function setCallbackUrl(string $callbackUrl): self |
| 79 | +{ |
| 80 | +$this->options['callback_url'] = $callbackUrl; |
| 81 | + |
| 82 | +return $this; |
| 83 | +} |
| 84 | + |
| 85 | +public function setDeliveryReport(bool $deliveryReport): self |
| 86 | +{ |
| 87 | +$this->options['delivery_report'] = $deliveryReport; |
| 88 | + |
| 89 | +return $this; |
| 90 | +} |
| 91 | + |
| 92 | +public function setFormat(string $format): self |
| 93 | +{ |
| 94 | +$this->options['format'] = $format; |
| 95 | + |
| 96 | +return $this; |
| 97 | +} |
| 98 | + |
| 99 | +public function setFrom(string $from): self |
| 100 | +{ |
| 101 | +$this->options['from'] = $from; |
| 102 | + |
| 103 | +return $this; |
| 104 | +} |
| 105 | + |
| 106 | +public function setMedia(array $media): self |
| 107 | +{ |
| 108 | +$this->options['media'] = $media; |
| 109 | + |
| 110 | +return $this; |
| 111 | +} |
| 112 | + |
| 113 | +public function setMessageExpiryTimestamp(int $messageExpiryTimestamp): self |
| 114 | +{ |
| 115 | +$this->options['message_expiry_timestamp'] = $messageExpiryTimestamp; |
| 116 | + |
| 117 | +return $this; |
| 118 | +} |
| 119 | + |
| 120 | +public function setMetadata(array $metadata): self |
| 121 | +{ |
| 122 | +$this->options['metadata'] = $metadata; |
| 123 | + |
| 124 | +return $this; |
| 125 | +} |
| 126 | + |
| 127 | +public function setRecipientId(string $id): self |
| 128 | +{ |
| 129 | +$this->options['recipient_id'] = $id; |
| 130 | + |
| 131 | +return $this; |
| 132 | +} |
| 133 | + |
| 134 | +public function setScheduled(string $scheduled): self |
| 135 | +{ |
| 136 | +$this->options['scheduled'] = $scheduled; |
| 137 | + |
| 138 | +return $this; |
| 139 | +} |
| 140 | + |
| 141 | +public function setSubject(string $subject): self |
| 142 | +{ |
| 143 | +$this->options['subject'] = $subject; |
| 144 | + |
| 145 | +return $this; |
| 146 | +} |
| 147 | + |
| 148 | +public function toArray(): array |
| 149 | +{ |
| 150 | +$options = $this->options; |
| 151 | +if (isset($options['recipient_id'])) { |
| 152 | +unset($options['recipient_id']); |
| 153 | +} |
| 154 | + |
| 155 | +return $options; |
| 156 | +} |
| 157 | +} |
0 commit comments