Completed
Pull Request — master (#250)
by David
07:25
created

ShowResponse::setContentIdMap()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
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\Resource\Api\Message;
11
12
use Mailgun\Resource\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
154
        return $response;
155
    }
156
157
    /**
158
     * @return string
159
     */
160
    public function getRecipient()
161
    {
162
        return $this->recipient;
163
    }
164
165
    /**
166
     * @param string $recipient
167
     */
168
    private function setRecipient($recipient)
169
    {
170
        $this->recipient = $recipient;
171
    }
172
173
    /**
174
     * @return string
175
     */
176
    public function getBodyMime()
177
    {
178
        return $this->bodyMime;
179
    }
180
181
    /**
182
     * @param string $bodyMime
183
     */
184
    private function setBodyMime($bodyMime)
185
    {
186
        $this->bodyMime = $bodyMime;
187
    }
188
189
    /**
190
     * @return string
191
     */
192
    public function getRecipients()
193
    {
194
        return $this->recipients;
195
    }
196
197
    /**
198
     * @param string $recipients
199
     */
200
    private function setRecipients($recipients)
201
    {
202
        $this->recipients = $recipients;
203
    }
204
205
    /**
206
     * @return string
207
     */
208
    public function getSender()
209
    {
210
        return $this->sender;
211
    }
212
213
    /**
214
     * @param string $sender
215
     */
216
    private function setSender($sender)
217
    {
218
        $this->sender = $sender;
219
    }
220
221
    /**
222
     * @return string
223
     */
224
    public function getFrom()
225
    {
226
        return $this->from;
227
    }
228
229
    /**
230
     * @param string $from
231
     */
232
    private function setFrom($from)
233
    {
234
        $this->from = $from;
235
    }
236
237
    /**
238
     * @return string
239
     */
240
    public function getSubject()
241
    {
242
        return $this->subject;
243
    }
244
245
    /**
246
     * @param string $subject
247
     */
248
    private function setSubject($subject)
249
    {
250
        $this->subject = $subject;
251
    }
252
253
    /**
254
     * @return string
255
     */
256
    public function getBodyPlain()
257
    {
258
        return $this->bodyPlain;
259
    }
260
261
    /**
262
     * @param string $bodyPlain
263
     */
264
    private function setBodyPlain($bodyPlain)
265
    {
266
        $this->bodyPlain = $bodyPlain;
267
    }
268
269
    /**
270
     * @return string
271
     */
272
    public function getStrippedText()
273
    {
274
        return $this->strippedText;
275
    }
276
277
    /**
278
     * @param string $strippedText
279
     */
280
    private function setStrippedText($strippedText)
281
    {
282
        $this->strippedText = $strippedText;
283
    }
284
285
    /**
286
     * @return string
287
     */
288
    public function getStrippedSignature()
289
    {
290
        return $this->strippedSignature;
291
    }
292
293
    /**
294
     * @param string $strippedSignature
295
     */
296
    private function setStrippedSignature($strippedSignature)
297
    {
298
        $this->strippedSignature = $strippedSignature;
299
    }
300
301
    /**
302
     * @return string
303
     */
304
    public function getBodyHtml()
305
    {
306
        return $this->bodyHtml;
307
    }
308
309
    /**
310
     * @param string $bodyHtml
311
     */
312
    private function setBodyHtml($bodyHtml)
313
    {
314
        $this->bodyHtml = $bodyHtml;
315
    }
316
317
    /**
318
     * @return string
319
     */
320
    public function getStrippedHtml()
321
    {
322
        return $this->strippedHtml;
323
    }
324
325
    /**
326
     * @param string $strippedHtml
327
     */
328
    private function setStrippedHtml($strippedHtml)
329
    {
330
        $this->strippedHtml = $strippedHtml;
331
    }
332
333
    /**
334
     * @return array
335
     */
336
    public function getAttachments()
337
    {
338
        return $this->attachments;
339
    }
340
341
    /**
342
     * @return string
343
     */
344
    public function getMessageUrl()
345
    {
346
        return $this->messageUrl;
347
    }
348
349
    /**
350
     * @param string $messageUrl
351
     */
352
    private function setMessageUrl($messageUrl)
353
    {
354
        $this->messageUrl = $messageUrl;
355
    }
356
357
    /**
358
     * @return string
359
     */
360
    public function getContentIdMap()
361
    {
362
        return $this->contentIdMap;
363
    }
364
365
    /**
366
     * @return array
367
     */
368
    public function getMessageHeaders()
369
    {
370
        return $this->messageHeaders;
371
    }
372
373
    /**
374
     * @param array $messageHeaders
375
     */
376
    private function setMessageHeaders(array $messageHeaders)
377
    {
378
        $this->messageHeaders = $messageHeaders;
379
    }
380
}
381