Completed
Push — master ( ac056e...2fe264 )
by David
04:27 queued 01:15
created

ShowResponse   A

Complexity

Total Complexity 17

Size/Duplication

Total Lines 125
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 17
lcom 1
cbo 0
dl 0
loc 125
ccs 0
cts 50
cp 0
rs 10
c 0
b 0
f 0

17 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A create() 0 21 1
A getRecipient() 0 4 1
A getBodyMime() 0 4 1
A getRecipients() 0 4 1
A getSender() 0 4 1
A getFrom() 0 4 1
A getSubject() 0 4 1
A getBodyPlain() 0 4 1
A getStrippedText() 0 4 1
A getStrippedSignature() 0 4 1
A getBodyHtml() 0 4 1
A getStrippedHtml() 0 4 1
A getAttachments() 0 4 1
A getMessageUrl() 0 4 1
A getContentIdMap() 0 4 1
A getMessageHeaders() 0 4 1
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