1 | <?php |
||
16 | class EmailLog extends AbstractModel |
||
|
|||
17 | { |
||
18 | use EmailAwareTrait; |
||
19 | |||
20 | /** |
||
21 | * Type of log (e.g., "email"). |
||
22 | * |
||
23 | * @var string $type |
||
24 | */ |
||
25 | private $type; |
||
26 | |||
27 | /** |
||
28 | * The action logged (e.g., "send"). |
||
29 | * |
||
30 | * @var string $action |
||
31 | */ |
||
32 | private $action; |
||
33 | |||
34 | /** |
||
35 | * The mailer's raw response. |
||
36 | * |
||
37 | * @var mixed $rawResponse |
||
38 | */ |
||
39 | private $rawResponse; |
||
40 | |||
41 | /** |
||
42 | * The Message-ID (Unique message identifier) |
||
43 | * |
||
44 | * @var string $messageId |
||
45 | */ |
||
46 | private $messageId; |
||
47 | |||
48 | /** |
||
49 | * The campaign ID. |
||
50 | * |
||
51 | * @var string $campaign |
||
52 | */ |
||
53 | private $campaign; |
||
54 | |||
55 | /** |
||
56 | * The sender's email address. |
||
57 | * |
||
58 | * @var string $from |
||
59 | */ |
||
60 | private $from; |
||
61 | |||
62 | /** |
||
63 | * The recipient's email address. |
||
64 | * |
||
65 | * @var string $to |
||
66 | */ |
||
67 | private $to; |
||
68 | |||
69 | /** |
||
70 | * The email subject. |
||
71 | * |
||
72 | * @var string $subject |
||
73 | */ |
||
74 | private $subject; |
||
75 | |||
76 | /** |
||
77 | * Whether the email has been semt. |
||
78 | * |
||
79 | * Error code (0 = success) |
||
80 | * |
||
81 | * @var integer $sendStatus |
||
82 | */ |
||
83 | private $sendStatus; |
||
84 | |||
85 | /** |
||
86 | * The error message from a failed send. |
||
87 | * |
||
88 | * @var string $sendError |
||
89 | */ |
||
90 | private $sendError; |
||
91 | |||
92 | /** |
||
93 | * When the email should be sent. |
||
94 | * |
||
95 | * @var DateTimeInterface|null $sendTs |
||
96 | */ |
||
97 | private $sendTs; |
||
98 | |||
99 | /** |
||
100 | * The current IP address at the time of the log. |
||
101 | * |
||
102 | * @var string $ip |
||
103 | */ |
||
104 | private $ip; |
||
105 | |||
106 | /** |
||
107 | * The current session ID at the time of the log. |
||
108 | * |
||
109 | * @var string $sessionId |
||
110 | */ |
||
111 | private $sessionId; |
||
112 | |||
113 | /** |
||
114 | * Get the primary key that uniquely identifies each queue item. |
||
115 | * |
||
116 | * @return string |
||
117 | */ |
||
118 | public function key() |
||
122 | |||
123 | /** |
||
124 | * Set the type of log. |
||
125 | * |
||
126 | * @param string $type The log type. (e.g., "email"). |
||
127 | * @throws InvalidArgumentException If the log type is not a string. |
||
128 | * @return self |
||
129 | */ |
||
130 | public function setType($type) |
||
142 | |||
143 | /** |
||
144 | * Get the log type. |
||
145 | * |
||
146 | * @return string |
||
147 | */ |
||
148 | public function type() |
||
152 | |||
153 | /** |
||
154 | * Set the logged action. |
||
155 | * |
||
156 | * @param string $action The log action (e.g., "send"). |
||
157 | * @throws InvalidArgumentException If the action is not a string. |
||
158 | * @return self |
||
159 | */ |
||
160 | public function setAction($action) |
||
172 | |||
173 | /** |
||
174 | * Get the logged action. |
||
175 | * |
||
176 | * @return string |
||
177 | */ |
||
178 | public function action() |
||
182 | |||
183 | /** |
||
184 | * Set the raw response from the mailer. |
||
185 | * |
||
186 | * @param mixed $res The response object or array. |
||
187 | * @return self |
||
188 | */ |
||
189 | public function setRawResponse($res) |
||
194 | |||
195 | /** |
||
196 | * Get the raw response from the mailer. |
||
197 | * |
||
198 | * @return mixed |
||
199 | */ |
||
200 | public function rawResponse() |
||
204 | |||
205 | /** |
||
206 | * Set the Message-ID. |
||
207 | * |
||
208 | * @param string $messageId The Message-ID. |
||
209 | * @throws InvalidArgumentException If the Message-ID is not a string. |
||
210 | * @return self |
||
211 | */ |
||
212 | public function setMessageId($messageId) |
||
224 | |||
225 | /** |
||
226 | * Get the Message-ID. |
||
227 | * |
||
228 | * @return string |
||
229 | */ |
||
230 | public function messageId() |
||
234 | |||
235 | |||
236 | /** |
||
237 | * Set the campaign ID. |
||
238 | * |
||
239 | * @param string $campaign The campaign identifier. |
||
240 | * @throws InvalidArgumentException If the campaign is invalid. |
||
241 | * @return self |
||
242 | */ |
||
243 | public function setCampaign($campaign) |
||
255 | |||
256 | /** |
||
257 | * Get the campaign identifier. |
||
258 | * |
||
259 | * @return string |
||
260 | */ |
||
261 | public function campaign() |
||
265 | |||
266 | /** |
||
267 | * Set the sender's email address. |
||
268 | * |
||
269 | * @param string|array $email An email address. |
||
270 | * @throws InvalidArgumentException If the email address is invalid. |
||
271 | * @return self |
||
272 | */ |
||
273 | public function setFrom($email) |
||
278 | |||
279 | /** |
||
280 | * Get the sender's email address. |
||
281 | * |
||
282 | * @return string |
||
283 | */ |
||
284 | public function from() |
||
288 | |||
289 | /** |
||
290 | * Set the recipient's email address. |
||
291 | * |
||
292 | * @param string|array $email An email address. |
||
293 | * @return self |
||
294 | */ |
||
295 | public function setTo($email) |
||
300 | |||
301 | /** |
||
302 | * Get the recipient's email address. |
||
303 | * |
||
304 | * @return string |
||
305 | */ |
||
306 | public function to() |
||
310 | |||
311 | /** |
||
312 | * Set the email subject. |
||
313 | * |
||
314 | * @param string $subject The email subject. |
||
315 | * @throws InvalidArgumentException If the subject is not a string. |
||
316 | * @return self |
||
317 | */ |
||
318 | public function setSubject($subject) |
||
330 | |||
331 | /** |
||
332 | * Get the email subject. |
||
333 | * |
||
334 | * @return string |
||
335 | */ |
||
336 | public function subject() |
||
340 | |||
341 | /** |
||
342 | * @param string $status The mailer's status code or description. |
||
343 | * @return self |
||
344 | */ |
||
345 | public function setSendStatus($status) |
||
350 | |||
351 | /** |
||
352 | * @return string|null |
||
353 | */ |
||
354 | public function sendStatus() |
||
358 | |||
359 | /** |
||
360 | * @param string $errorMessage The mailer's error code or description. |
||
361 | * @return self |
||
362 | */ |
||
363 | public function setSendError($errorMessage) |
||
368 | |||
369 | /** |
||
370 | * @return string|null |
||
371 | */ |
||
372 | public function sendError() |
||
376 | |||
377 | /** |
||
378 | * @param null|string|DateTime $ts The "send date" datetime value. |
||
379 | * @throws InvalidArgumentException If the ts is not a valid datetime value. |
||
380 | * @return self |
||
381 | */ |
||
382 | public function setSendTs($ts) |
||
406 | |||
407 | /** |
||
408 | * @return null|DateTimeInterface |
||
409 | */ |
||
410 | public function sendTs() |
||
414 | |||
415 | /** |
||
416 | * @param mixed $ip The IP adress. |
||
417 | * @return self |
||
418 | */ |
||
419 | public function setIp($ip) |
||
424 | |||
425 | /** |
||
426 | * @return mixed |
||
427 | */ |
||
428 | public function ip() |
||
432 | |||
433 | /** |
||
434 | * @param string $sessionId The session identifier. |
||
435 | * @return self |
||
436 | */ |
||
437 | public function setSessionId($sessionId) |
||
442 | |||
443 | /** |
||
444 | * @return string |
||
445 | */ |
||
446 | public function sessionId() |
||
450 | |||
451 | /** |
||
452 | * @see StorableTrait::preSave() |
||
453 | * @return boolean |
||
454 | */ |
||
455 | protected function preSave() |
||
471 | } |
||
472 |