Completed
Pull Request — master (#247)
by Tobias
05:45
created

ShowResponse::setAttachments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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