1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* Copyright (C) 2013 Mailgun |
7
|
|
|
* |
8
|
|
|
* This software may be modified and distributed under the terms |
9
|
|
|
* of the MIT license. See the LICENSE file for details. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Mailgun\Model\Message; |
13
|
|
|
|
14
|
|
|
use Mailgun\Model\ApiResponse; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @author Tobias Nyholm <[email protected]> |
18
|
|
|
*/ |
19
|
|
|
final class ShowResponse implements ApiResponse |
20
|
|
|
{ |
21
|
|
|
private $recipient; |
22
|
|
|
private $bodyMime; |
23
|
|
|
private $recipients; |
24
|
|
|
private $sender; |
25
|
|
|
private $from; |
26
|
|
|
private $subject; |
27
|
|
|
private $bodyPlain; |
28
|
|
|
private $strippedText; |
29
|
|
|
private $strippedSignature; |
30
|
|
|
private $bodyHtml; |
31
|
|
|
private $strippedHtml; |
32
|
|
|
private $attachments; |
33
|
|
|
private $messageUrl; |
34
|
|
|
private $contentIdMap; |
35
|
|
|
private $messageHeaders; |
36
|
|
|
|
37
|
|
|
private function __construct() |
38
|
|
|
{ |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public static function create(array $data): self |
42
|
|
|
{ |
43
|
|
|
$model = new self(); |
44
|
|
|
$model->recipients = $data['recipients'] ?? null; |
45
|
|
|
$model->sender = $data['sender'] ?? null; |
46
|
|
|
$model->from = $data['from'] ?? null; |
47
|
|
|
$model->subject = $data['subject'] ?? null; |
48
|
|
|
$model->bodyPlain = $data['body-plain'] ?? null; |
49
|
|
|
$model->strippedText = $data['stripped-text'] ?? null; |
50
|
|
|
$model->strippedSignature = $data['stripped-signature'] ?? null; |
51
|
|
|
$model->bodyHtml = $data['body-html'] ?? null; |
52
|
|
|
$model->strippedHtml = $data['stripped-html'] ?? null; |
53
|
|
|
$model->messageUrl = $data['message-url'] ?? null; |
54
|
|
|
$model->messageHeaders = $data['message-headers'] ?? null; |
55
|
|
|
$model->recipient = $data['recipient'] ?? null; |
56
|
|
|
$model->bodyMime = $data['body-mime'] ?? null; |
57
|
|
|
$model->attachments = $data['attachments'] ?? []; |
58
|
|
|
$model->contentIdMap = $data['content-id-map'] ?? null; |
59
|
|
|
|
60
|
|
|
return $model; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Only available with message/rfc2822. |
65
|
|
|
*/ |
66
|
|
|
public function getRecipient(): ?string |
67
|
|
|
{ |
68
|
|
|
return $this->recipient; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Only available with message/rfc2822. |
73
|
|
|
*/ |
74
|
|
|
public function getBodyMime(): ?string |
75
|
|
|
{ |
76
|
|
|
return $this->bodyMime; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public function getRecipients(): ?string |
80
|
|
|
{ |
81
|
|
|
return $this->recipients; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
public function getSender(): ?string |
85
|
|
|
{ |
86
|
|
|
return $this->sender; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function getFrom(): ?string |
90
|
|
|
{ |
91
|
|
|
return $this->from; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
public function getSubject(): ?string |
95
|
|
|
{ |
96
|
|
|
return $this->subject; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
public function getBodyPlain(): ?string |
100
|
|
|
{ |
101
|
|
|
return $this->bodyPlain; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public function getStrippedText(): ?string |
105
|
|
|
{ |
106
|
|
|
return $this->strippedText; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
public function getStrippedSignature(): ?string |
110
|
|
|
{ |
111
|
|
|
return $this->strippedSignature; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
public function getBodyHtml(): ?string |
115
|
|
|
{ |
116
|
|
|
return $this->bodyHtml; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public function getStrippedHtml(): ?string |
120
|
|
|
{ |
121
|
|
|
return $this->strippedHtml; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
public function getAttachments(): array |
125
|
|
|
{ |
126
|
|
|
return $this->attachments; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
public function getMessageUrl(): ?string |
130
|
|
|
{ |
131
|
|
|
return $this->messageUrl; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
public function getContentIdMap(): ?string |
135
|
|
|
{ |
136
|
|
|
return $this->contentIdMap; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
public function getMessageHeaders(): array |
140
|
|
|
{ |
141
|
|
|
return $this->messageHeaders; |
142
|
|
|
} |
143
|
|
|
} |
144
|
|
|
|