1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* Copyright (C) 2013-2016 Mailgun |
5
|
|
|
* |
6
|
|
|
* This software may be modified and distributed under the terms |
7
|
|
|
* of the MIT license. See the LICENSE file for details. |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace Mailgun\Model\Message; |
11
|
|
|
|
12
|
|
|
use Mailgun\Model\ApiResponse; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @author Tobias Nyholm <[email protected]> |
16
|
|
|
*/ |
17
|
|
|
class ShowResponse implements ApiResponse |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* Only available with message/rfc2822. |
21
|
|
|
* |
22
|
|
|
* @var string |
23
|
|
|
*/ |
24
|
|
|
private $recipient; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Only available with message/rfc2822. |
28
|
|
|
* |
29
|
|
|
* @var string |
30
|
|
|
*/ |
31
|
|
|
private $bodyMime; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var string |
35
|
|
|
*/ |
36
|
|
|
private $recipients; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var string |
40
|
|
|
*/ |
41
|
|
|
private $sender; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var string |
45
|
|
|
*/ |
46
|
|
|
private $from; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var string |
50
|
|
|
*/ |
51
|
|
|
private $subject; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @var string |
55
|
|
|
*/ |
56
|
|
|
private $bodyPlain; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @var string |
60
|
|
|
*/ |
61
|
|
|
private $strippedText; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @var string |
65
|
|
|
*/ |
66
|
|
|
private $strippedSignature; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @var string |
70
|
|
|
*/ |
71
|
|
|
private $bodyHtml; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @var string |
75
|
|
|
*/ |
76
|
|
|
private $strippedHtml; |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @var array |
80
|
|
|
*/ |
81
|
|
|
private $attachments; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @var string |
85
|
|
|
*/ |
86
|
|
|
private $messageUrl; |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @var string |
90
|
|
|
*/ |
91
|
|
|
private $contentIdMap; |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @var array |
95
|
|
|
*/ |
96
|
|
|
private $messageHeaders; |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Do not let this object be creted without the ::create. |
100
|
|
|
*/ |
101
|
|
|
private function __construct() |
102
|
|
|
{ |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @param array $data |
107
|
|
|
* |
108
|
|
|
* @return SendResponse |
109
|
|
|
*/ |
110
|
|
|
public static function create(array $data) |
111
|
|
|
{ |
112
|
|
|
$response = new self(); |
113
|
|
|
|
114
|
|
|
if (isset($data['recipients'])) { |
115
|
|
|
$response->setRecipients($data['recipients']); |
116
|
|
|
} |
117
|
|
|
if (isset($data['sender'])) { |
118
|
|
|
$response->setSender($data['sender']); |
119
|
|
|
} |
120
|
|
|
if (isset($data['from'])) { |
121
|
|
|
$response->setFrom($data['from']); |
122
|
|
|
} |
123
|
|
|
if (isset($data['subject'])) { |
124
|
|
|
$response->setSubject($data['subject']); |
125
|
|
|
} |
126
|
|
|
if (isset($data['body-plain'])) { |
127
|
|
|
$response->setBodyPlain($data['body-plain']); |
128
|
|
|
} |
129
|
|
|
if (isset($data['stripped-text'])) { |
130
|
|
|
$response->setStrippedText($data['stripped-text']); |
131
|
|
|
} |
132
|
|
|
if (isset($data['stripped-signature'])) { |
133
|
|
|
$response->setStrippedSignature($data['stripped-signature']); |
134
|
|
|
} |
135
|
|
|
if (isset($data['body-html'])) { |
136
|
|
|
$response->setBodyHtml($data['body-html']); |
137
|
|
|
} |
138
|
|
|
if (isset($data['stripped-html'])) { |
139
|
|
|
$response->setStrippedHtml($data['stripped-html']); |
140
|
|
|
} |
141
|
|
|
if (isset($data['message-url'])) { |
142
|
|
|
$response->setMessageUrl($data['message-url']); |
143
|
|
|
} |
144
|
|
|
if (isset($data['message-headers'])) { |
145
|
|
|
$response->setMessageHeaders($data['message-headers']); |
146
|
|
|
} |
147
|
|
|
if (isset($data['recipient'])) { |
148
|
|
|
$response->setRecipient($data['recipient']); |
149
|
|
|
} |
150
|
|
|
if (isset($data['body-mime'])) { |
151
|
|
|
$response->setBodyMime($data['body-mime']); |
152
|
|
|
} |
153
|
|
|
if (isset($data['attachments'])) { |
154
|
|
|
$response->setAttachments($data['attachments']); |
155
|
|
|
} |
156
|
|
|
if (isset($data['content-id-map'])) { |
157
|
|
|
$response->setContentIdMap($data['content-id-map']); |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
return $response; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @return string |
165
|
|
|
*/ |
166
|
|
|
public function getRecipient() |
167
|
|
|
{ |
168
|
|
|
return $this->recipient; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* @param string $recipient |
173
|
|
|
*/ |
174
|
|
|
private function setRecipient($recipient) |
175
|
|
|
{ |
176
|
|
|
$this->recipient = $recipient; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* @return string |
181
|
|
|
*/ |
182
|
|
|
public function getBodyMime() |
183
|
|
|
{ |
184
|
|
|
return $this->bodyMime; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* @param string $bodyMime |
189
|
|
|
*/ |
190
|
|
|
private function setBodyMime($bodyMime) |
191
|
|
|
{ |
192
|
|
|
$this->bodyMime = $bodyMime; |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* @return string |
197
|
|
|
*/ |
198
|
|
|
public function getRecipients() |
199
|
|
|
{ |
200
|
|
|
return $this->recipients; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* @param string $recipients |
205
|
|
|
*/ |
206
|
|
|
private function setRecipients($recipients) |
207
|
|
|
{ |
208
|
|
|
$this->recipients = $recipients; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* @return string |
213
|
|
|
*/ |
214
|
|
|
public function getSender() |
215
|
|
|
{ |
216
|
|
|
return $this->sender; |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* @param string $sender |
221
|
|
|
*/ |
222
|
|
|
private function setSender($sender) |
223
|
|
|
{ |
224
|
|
|
$this->sender = $sender; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* @return string |
229
|
|
|
*/ |
230
|
|
|
public function getFrom() |
231
|
|
|
{ |
232
|
|
|
return $this->from; |
233
|
|
|
} |
234
|
|
|
|
235
|
|
|
/** |
236
|
|
|
* @param string $from |
237
|
|
|
*/ |
238
|
|
|
private function setFrom($from) |
239
|
|
|
{ |
240
|
|
|
$this->from = $from; |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
/** |
244
|
|
|
* @return string |
245
|
|
|
*/ |
246
|
|
|
public function getSubject() |
247
|
|
|
{ |
248
|
|
|
return $this->subject; |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
/** |
252
|
|
|
* @param string $subject |
253
|
|
|
*/ |
254
|
|
|
private function setSubject($subject) |
255
|
|
|
{ |
256
|
|
|
$this->subject = $subject; |
257
|
|
|
} |
258
|
|
|
|
259
|
|
|
/** |
260
|
|
|
* @return string |
261
|
|
|
*/ |
262
|
|
|
public function getBodyPlain() |
263
|
|
|
{ |
264
|
|
|
return $this->bodyPlain; |
265
|
|
|
} |
266
|
|
|
|
267
|
|
|
/** |
268
|
|
|
* @param string $bodyPlain |
269
|
|
|
*/ |
270
|
|
|
private function setBodyPlain($bodyPlain) |
271
|
|
|
{ |
272
|
|
|
$this->bodyPlain = $bodyPlain; |
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* @return string |
277
|
|
|
*/ |
278
|
|
|
public function getStrippedText() |
279
|
|
|
{ |
280
|
|
|
return $this->strippedText; |
281
|
|
|
} |
282
|
|
|
|
283
|
|
|
/** |
284
|
|
|
* @param string $strippedText |
285
|
|
|
*/ |
286
|
|
|
private function setStrippedText($strippedText) |
287
|
|
|
{ |
288
|
|
|
$this->strippedText = $strippedText; |
289
|
|
|
} |
290
|
|
|
|
291
|
|
|
/** |
292
|
|
|
* @return string |
293
|
|
|
*/ |
294
|
|
|
public function getStrippedSignature() |
295
|
|
|
{ |
296
|
|
|
return $this->strippedSignature; |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
/** |
300
|
|
|
* @param string $strippedSignature |
301
|
|
|
*/ |
302
|
|
|
private function setStrippedSignature($strippedSignature) |
303
|
|
|
{ |
304
|
|
|
$this->strippedSignature = $strippedSignature; |
305
|
|
|
} |
306
|
|
|
|
307
|
|
|
/** |
308
|
|
|
* @return string |
309
|
|
|
*/ |
310
|
|
|
public function getBodyHtml() |
311
|
|
|
{ |
312
|
|
|
return $this->bodyHtml; |
313
|
|
|
} |
314
|
|
|
|
315
|
|
|
/** |
316
|
|
|
* @param string $bodyHtml |
317
|
|
|
*/ |
318
|
|
|
private function setBodyHtml($bodyHtml) |
319
|
|
|
{ |
320
|
|
|
$this->bodyHtml = $bodyHtml; |
321
|
|
|
} |
322
|
|
|
|
323
|
|
|
/** |
324
|
|
|
* @return string |
325
|
|
|
*/ |
326
|
|
|
public function getStrippedHtml() |
327
|
|
|
{ |
328
|
|
|
return $this->strippedHtml; |
329
|
|
|
} |
330
|
|
|
|
331
|
|
|
/** |
332
|
|
|
* @param string $strippedHtml |
333
|
|
|
*/ |
334
|
|
|
private function setStrippedHtml($strippedHtml) |
335
|
|
|
{ |
336
|
|
|
$this->strippedHtml = $strippedHtml; |
337
|
|
|
} |
338
|
|
|
|
339
|
|
|
/** |
340
|
|
|
* @return array |
341
|
|
|
*/ |
342
|
|
|
public function getAttachments() |
343
|
|
|
{ |
344
|
|
|
return $this->attachments; |
345
|
|
|
} |
346
|
|
|
|
347
|
|
|
/** |
348
|
|
|
* @param array $attachments |
349
|
|
|
*/ |
350
|
|
|
private function setAttachments($attachments) |
351
|
|
|
{ |
352
|
|
|
$this->attachments = $attachments; |
353
|
|
|
} |
354
|
|
|
|
355
|
|
|
/** |
356
|
|
|
* @return string |
357
|
|
|
*/ |
358
|
|
|
public function getMessageUrl() |
359
|
|
|
{ |
360
|
|
|
return $this->messageUrl; |
361
|
|
|
} |
362
|
|
|
|
363
|
|
|
/** |
364
|
|
|
* @param string $messageUrl |
365
|
|
|
*/ |
366
|
|
|
private function setMessageUrl($messageUrl) |
367
|
|
|
{ |
368
|
|
|
$this->messageUrl = $messageUrl; |
369
|
|
|
} |
370
|
|
|
|
371
|
|
|
/** |
372
|
|
|
* @return string |
373
|
|
|
*/ |
374
|
|
|
public function getContentIdMap() |
375
|
|
|
{ |
376
|
|
|
return $this->contentIdMap; |
377
|
|
|
} |
378
|
|
|
|
379
|
|
|
/** |
380
|
|
|
* @param string $contentIdMap |
381
|
|
|
*/ |
382
|
|
|
public function setContentIdMap($contentIdMap) |
383
|
|
|
{ |
384
|
|
|
$this->contentIdMap = $contentIdMap; |
385
|
|
|
} |
386
|
|
|
|
387
|
|
|
/** |
388
|
|
|
* @return array |
389
|
|
|
*/ |
390
|
|
|
public function getMessageHeaders() |
391
|
|
|
{ |
392
|
|
|
return $this->messageHeaders; |
393
|
|
|
} |
394
|
|
|
|
395
|
|
|
/** |
396
|
|
|
* @param array $messageHeaders |
397
|
|
|
*/ |
398
|
|
|
private function setMessageHeaders(array $messageHeaders) |
399
|
|
|
{ |
400
|
|
|
$this->messageHeaders = $messageHeaders; |
401
|
|
|
} |
402
|
|
|
} |
403
|
|
|
|