1 | <?php declare(strict_types = 1); |
||
13 | class SwiftEmail implements Email |
||
14 | { |
||
15 | /** |
||
16 | * @var Swift_Message |
||
17 | */ |
||
18 | private $message; |
||
19 | |||
20 | /** |
||
21 | * Constructor. |
||
22 | * |
||
23 | * @param Swift_Message|null $message |
||
24 | */ |
||
25 | public function __construct(Swift_Message $message = null) |
||
29 | |||
30 | /** |
||
31 | * Get message. |
||
32 | * |
||
33 | * @return Swift_Message |
||
34 | */ |
||
35 | public function getMessage() |
||
39 | |||
40 | /** |
||
41 | * Set the From addresses. |
||
42 | * |
||
43 | * @param Address[] $addresses |
||
44 | * |
||
45 | * @return self |
||
46 | */ |
||
47 | public function setFrom(array $addresses): Email |
||
54 | |||
55 | /** |
||
56 | * Get the To addresses for this message. |
||
57 | * |
||
58 | * @return Address[] |
||
59 | */ |
||
60 | public function getFrom(): array |
||
66 | |||
67 | /** |
||
68 | * Set the Reply-To addresses. |
||
69 | * |
||
70 | * Any replies from the receiver will be sent to this address. |
||
71 | * |
||
72 | * @param Address[] $addresses |
||
73 | * |
||
74 | * @return self |
||
75 | */ |
||
76 | public function setReplyTo(array $addresses): Email |
||
83 | |||
84 | /** |
||
85 | * Get the Reply-To addresses for this message. |
||
86 | * |
||
87 | * @return Address[] |
||
88 | */ |
||
89 | public function getReplyTo(): array |
||
95 | |||
96 | /** |
||
97 | * Set the To addresses. |
||
98 | * |
||
99 | * Recipients set in this field will receive a copy of this message. |
||
100 | * |
||
101 | * @param Address[] $addresses |
||
102 | * |
||
103 | * @return self |
||
104 | */ |
||
105 | public function setTo(array $addresses): Email |
||
112 | |||
113 | /** |
||
114 | * Get the To addresses for this message. |
||
115 | * |
||
116 | * @return Address[] |
||
117 | */ |
||
118 | public function getTo(): array |
||
124 | |||
125 | /** |
||
126 | * Set the Cc addresses. |
||
127 | * |
||
128 | * Recipients set in this field will receive a 'carbon-copy' of this message. |
||
129 | * |
||
130 | * @param Address[] $addresses |
||
131 | * |
||
132 | * @return self |
||
133 | */ |
||
134 | public function setCc(array $addresses): Email |
||
141 | |||
142 | /** |
||
143 | * Get the Cc addresses for this message. |
||
144 | * |
||
145 | * @return Address[] |
||
146 | */ |
||
147 | public function getCc(): array |
||
153 | |||
154 | /** |
||
155 | * Set the Bcc addresses. |
||
156 | * |
||
157 | * Recipients set in this field will receive a 'blind-carbon-copy' of this message. |
||
158 | * |
||
159 | * @param Address[] $addresses |
||
160 | * |
||
161 | * @return self |
||
162 | */ |
||
163 | public function setBcc(array $addresses): Email |
||
170 | |||
171 | /** |
||
172 | * Get the Bcc addresses for this message. |
||
173 | * |
||
174 | * @return Address[] |
||
175 | */ |
||
176 | public function getBcc(): array |
||
182 | |||
183 | /** |
||
184 | * Set the sender of this message. |
||
185 | * |
||
186 | * @param Address $address |
||
187 | * |
||
188 | * @return self |
||
189 | */ |
||
190 | public function setSender(Address $address): Email |
||
196 | |||
197 | /** |
||
198 | * Get the sender address for this message. |
||
199 | * |
||
200 | * @return Address|null |
||
201 | */ |
||
202 | public function getSender() |
||
212 | |||
213 | /** |
||
214 | * Set the bounce address for this message. |
||
215 | * |
||
216 | * @param Address $address |
||
217 | */ |
||
218 | public function setBounce(Address $address): Email |
||
224 | |||
225 | /** |
||
226 | * Get the bounce address for this message. |
||
227 | * |
||
228 | * @return Address|null |
||
229 | */ |
||
230 | public function getBounce() |
||
240 | |||
241 | /** |
||
242 | * Set the subject of the message. |
||
243 | * |
||
244 | * @param string $subject |
||
245 | * |
||
246 | * @return self |
||
247 | */ |
||
248 | public function setSubject($subject): Email |
||
254 | |||
255 | /** |
||
256 | * Get the subject of the message. |
||
257 | * |
||
258 | * @return string |
||
259 | */ |
||
260 | public function getSubject(): string |
||
264 | |||
265 | /** |
||
266 | * Add message body to email. |
||
267 | * |
||
268 | * @param Message $message |
||
269 | * |
||
270 | * @return self |
||
271 | */ |
||
272 | public function addMessage(Message $message): Email |
||
284 | |||
285 | /** |
||
286 | * Get all message body parts from the email. |
||
287 | * |
||
288 | * @return Message[] |
||
289 | */ |
||
290 | public function getMessages(): array |
||
300 | |||
301 | /** |
||
302 | * Transform addresses. |
||
303 | * |
||
304 | * Convert an array of Addresses to a format swift mailer can work with. |
||
305 | * |
||
306 | * @param Address[] $addresses |
||
307 | * |
||
308 | * @return array |
||
309 | */ |
||
310 | private function transformAddressesToArray($addresses): array |
||
325 | |||
326 | /** |
||
327 | * Transform addresses. |
||
328 | * |
||
329 | * Convert an array of Addresses to a format swift mailer can work with. |
||
330 | * |
||
331 | * @param Address[] $addresses |
||
332 | * |
||
333 | * @return array |
||
334 | */ |
||
335 | private function transformArrayToAddresses($addresses): array |
||
345 | } |
||
346 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: