1 | <?php |
||
10 | class Notification |
||
11 | { |
||
12 | /** |
||
13 | * @var null|NotificationId |
||
14 | */ |
||
15 | protected $notificationId; |
||
16 | |||
17 | /** |
||
18 | * @var Destination |
||
19 | */ |
||
20 | protected $destination; |
||
21 | |||
22 | /** |
||
23 | * @var Subject |
||
24 | */ |
||
25 | protected $subject; |
||
26 | |||
27 | /** |
||
28 | * @var Body |
||
29 | */ |
||
30 | protected $body; |
||
31 | |||
32 | /** |
||
33 | * @var null|DeduplicationKey |
||
34 | */ |
||
35 | protected $deduplicationKey; |
||
36 | |||
37 | /** |
||
38 | * @var null|string |
||
39 | */ |
||
40 | protected $templateName; |
||
41 | |||
42 | /** |
||
43 | * @var array|null |
||
44 | */ |
||
45 | protected $templateVariables; |
||
46 | |||
47 | /** |
||
48 | * @var DateTimeImmutable |
||
49 | */ |
||
50 | protected $createdAt; |
||
51 | |||
52 | /** |
||
53 | * @var null|DateTimeImmutable |
||
54 | */ |
||
55 | protected $sentAt; |
||
56 | |||
57 | /** |
||
58 | * @var null|DateTimeImmutable |
||
59 | */ |
||
60 | protected $failedAt; |
||
61 | |||
62 | /** |
||
63 | * @var null|string |
||
64 | */ |
||
65 | protected $failedFor; |
||
66 | |||
67 | /** |
||
68 | * @var null|DateTimeImmutable |
||
69 | */ |
||
70 | protected $lockedAt; |
||
71 | |||
72 | /** |
||
73 | * @param Destination $destination |
||
74 | * @param Subject $subject |
||
75 | * @param Body $body |
||
76 | * @param DeduplicationKey|null $deduplicationKey |
||
77 | * @param string|null $templateName |
||
78 | * @param array|null $templateVariables |
||
79 | */ |
||
80 | 15 | public function __construct( |
|
100 | |||
101 | /** |
||
102 | * @return null|NotificationId |
||
103 | */ |
||
104 | 3 | public function notificationId(): ?NotificationId |
|
108 | |||
109 | /** |
||
110 | * @return Destination |
||
111 | */ |
||
112 | 11 | public function destination(): Destination |
|
116 | |||
117 | /** |
||
118 | * @return Subject |
||
119 | */ |
||
120 | 6 | public function subject(): Subject |
|
124 | |||
125 | /** |
||
126 | * @return Body |
||
127 | */ |
||
128 | 4 | public function body(): Body |
|
132 | |||
133 | /** |
||
134 | * @return null|DeduplicationKey |
||
135 | */ |
||
136 | 5 | public function deduplicationKey(): ?DeduplicationKey |
|
140 | |||
141 | /** |
||
142 | * @return DateTimeImmutable |
||
143 | */ |
||
144 | 3 | public function createdAt(): DateTimeImmutable |
|
148 | |||
149 | /** |
||
150 | * @return DateTimeImmutable|null |
||
151 | */ |
||
152 | 7 | public function sentAt(): ?DateTimeImmutable |
|
156 | |||
157 | /** |
||
158 | * @return bool |
||
159 | */ |
||
160 | 7 | public function isSent(): bool |
|
164 | |||
165 | /** |
||
166 | * @return void |
||
167 | */ |
||
168 | 5 | public function markSent(): void |
|
174 | |||
175 | /** |
||
176 | * @return DateTimeImmutable|null |
||
177 | */ |
||
178 | 3 | public function failedAt(): ?DateTimeImmutable |
|
182 | |||
183 | /** |
||
184 | * @return null|string |
||
185 | */ |
||
186 | 2 | public function failedFor(): ?string |
|
190 | |||
191 | /** |
||
192 | * @return bool |
||
193 | */ |
||
194 | 3 | public function isFailed(): bool |
|
198 | |||
199 | /** |
||
200 | * @param string $reason |
||
201 | */ |
||
202 | 3 | public function markFailed(string $reason): void |
|
208 | |||
209 | /** |
||
210 | * @return void |
||
211 | */ |
||
212 | 5 | public function unmarkFailed(): void |
|
217 | |||
218 | /** |
||
219 | * @return DateTimeImmutable|null |
||
220 | */ |
||
221 | 3 | public function lockedAt(): ?DateTimeImmutable |
|
225 | |||
226 | /** |
||
227 | * @return bool |
||
228 | */ |
||
229 | 3 | public function isLocked(): bool |
|
233 | |||
234 | 2 | public function lock(): void |
|
238 | |||
239 | /** |
||
240 | * @return void |
||
241 | */ |
||
242 | 1 | public function unlock(): void |
|
246 | |||
247 | /** |
||
248 | * @return bool |
||
249 | */ |
||
250 | 1 | public function isFresh(): bool |
|
254 | |||
255 | /** |
||
256 | * @return void |
||
257 | */ |
||
258 | 7 | private function assertNotSent(): void |
|
270 | |||
271 | /** |
||
272 | * For InMemoryNotificationRepository only. |
||
273 | * |
||
274 | * @param NotificationId $notificationId |
||
275 | */ |
||
276 | 2 | public function setNotificationId(NotificationId $notificationId): void |
|
280 | } |
||
281 | |||
282 |