1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Linio\Component\Mail; |
6
|
|
|
|
7
|
|
|
class Message |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* @var Contact |
11
|
|
|
*/ |
12
|
|
|
protected $from; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @var Contact[] |
16
|
|
|
*/ |
17
|
|
|
protected $to = []; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @var Contact[] |
21
|
|
|
*/ |
22
|
|
|
protected $cc = []; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var Contact[] |
26
|
|
|
*/ |
27
|
|
|
protected $bcc = []; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var string |
31
|
|
|
*/ |
32
|
|
|
protected $subject; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var Contact |
36
|
|
|
*/ |
37
|
|
|
protected $replyTo; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var array |
41
|
|
|
*/ |
42
|
|
|
protected $headers = []; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var mixed |
46
|
|
|
*/ |
47
|
|
|
protected $data; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var string |
51
|
|
|
*/ |
52
|
|
|
protected $template; |
53
|
|
|
|
54
|
|
|
public function getFrom(): Contact |
55
|
|
|
{ |
56
|
|
|
return $this->from; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function setFrom(Contact $from): void |
60
|
|
|
{ |
61
|
|
|
$this->from = $from; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @return Contact[] |
66
|
|
|
*/ |
67
|
|
|
public function getTo(): array |
68
|
|
|
{ |
69
|
|
|
return $this->to; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @param Contact[] $to |
74
|
|
|
*/ |
75
|
|
|
public function setTo(array $to): void |
76
|
|
|
{ |
77
|
|
|
$this->to = $to; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function addTo(Contact $to): void |
81
|
|
|
{ |
82
|
|
|
$this->to[] = $to; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @return Contact[] |
87
|
|
|
*/ |
88
|
|
|
public function getCc(): array |
89
|
|
|
{ |
90
|
|
|
return $this->cc; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @param Contact[] $cc |
95
|
|
|
*/ |
96
|
|
|
public function setCc(array $cc): void |
97
|
|
|
{ |
98
|
|
|
$this->cc = $cc; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
public function addCc(Contact $cc): void |
102
|
|
|
{ |
103
|
|
|
$this->cc[] = $cc; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @return Contact[] |
108
|
|
|
*/ |
109
|
|
|
public function getBcc(): array |
110
|
|
|
{ |
111
|
|
|
return $this->bcc; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @param Contact[] $bcc |
116
|
|
|
*/ |
117
|
|
|
public function setBcc($bcc): void |
118
|
|
|
{ |
119
|
|
|
$this->bcc = $bcc; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
public function addBcc(Contact $bcc): void |
123
|
|
|
{ |
124
|
|
|
$this->bcc[] = $bcc; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
public function getSubject(): string |
128
|
|
|
{ |
129
|
|
|
return $this->subject; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
public function setSubject(string $subject): void |
133
|
|
|
{ |
134
|
|
|
$this->subject = $subject; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
public function getReplyTo(): Contact |
138
|
|
|
{ |
139
|
|
|
return $this->replyTo; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
public function setReplyTo(Contact $replyTo): void |
143
|
|
|
{ |
144
|
|
|
$this->replyTo = $replyTo; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
public function getHeaders(): array |
148
|
|
|
{ |
149
|
|
|
return $this->headers; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
public function setHeaders(array $headers): void |
153
|
|
|
{ |
154
|
|
|
$this->headers = $headers; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
public function addHeader(string $key, string $value): void |
158
|
|
|
{ |
159
|
|
|
$this->headers[$key] = $value; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
public function getData() |
163
|
|
|
{ |
164
|
|
|
return $this->data; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
public function setData($data): void |
168
|
|
|
{ |
169
|
|
|
$this->data = $data; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
public function getTemplate(): string |
173
|
|
|
{ |
174
|
|
|
return $this->template; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
public function setTemplate(string $template): void |
178
|
|
|
{ |
179
|
|
|
$this->template = $template; |
180
|
|
|
} |
181
|
|
|
} |
182
|
|
|
|