1 | <?php |
||
12 | class PostmarkTransport extends Transport |
||
13 | { |
||
14 | /** |
||
15 | * Guzzle client instance. |
||
16 | * |
||
17 | * @var \GuzzleHttp\ClientInterface |
||
18 | */ |
||
19 | protected $client; |
||
20 | |||
21 | /** |
||
22 | * The Postmark API key. |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $key; |
||
27 | |||
28 | /** |
||
29 | * The Postmark API end-point. |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $url = 'https://api.postmarkapp.com/email'; |
||
34 | |||
35 | /** |
||
36 | * Create a new Postmark transport instance. |
||
37 | * |
||
38 | * @param \GuzzleHttp\ClientInterface $client |
||
39 | * @param string $key |
||
40 | * |
||
41 | * @return void |
||
42 | * @throws \Coconuts\Mail\Exceptions\PostmarkException |
||
43 | */ |
||
44 | public function __construct(ClientInterface $client, $key) |
||
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) |
||
74 | |||
75 | /** |
||
76 | * Get all attachments for the given message. |
||
77 | * |
||
78 | * @param \Swift_Mime_SimpleMessage $message |
||
79 | * |
||
80 | * @return array |
||
81 | */ |
||
82 | protected function getAttachments(Swift_Mime_SimpleMessage $message) |
||
98 | |||
99 | /** |
||
100 | * Format the display name. |
||
101 | * |
||
102 | * @param string |
||
103 | * @return string |
||
104 | */ |
||
105 | protected function getDisplayname($value) |
||
113 | |||
114 | /** |
||
115 | * Format the contacts for the API request. |
||
116 | * |
||
117 | * @param string|array $contacts |
||
118 | * |
||
119 | * @return string |
||
120 | */ |
||
121 | protected function getContacts($contacts) |
||
130 | |||
131 | /** |
||
132 | * Get the message ID from the response. |
||
133 | * |
||
134 | * @param \GuzzleHttp\Psr7\Response $response |
||
135 | * |
||
136 | * @return string |
||
137 | */ |
||
138 | protected function getMessageId($response) |
||
145 | |||
146 | /** |
||
147 | * Get the body for the given message. |
||
148 | * |
||
149 | * @param \Swift_Mime_SimpleMessage $message |
||
150 | * |
||
151 | * @return string |
||
152 | */ |
||
153 | protected function getBody(Swift_Mime_SimpleMessage $message) |
||
157 | |||
158 | /** |
||
159 | * Get the text and html fields for the given message. |
||
160 | * |
||
161 | * @param \Swift_Mime_SimpleMessage $message |
||
162 | * |
||
163 | * @return array |
||
164 | */ |
||
165 | protected function getHtmlAndTextBody(Swift_Mime_SimpleMessage $message) |
||
183 | |||
184 | /** |
||
185 | * Get a mime part from the given message. |
||
186 | * |
||
187 | * @param \Swift_Mime_SimpleMessage $message |
||
188 | * @param string $mimeType |
||
189 | * |
||
190 | * @return \Swift_MimePart|null |
||
191 | */ |
||
192 | protected function getMimePart(Swift_Mime_SimpleMessage $message, $mimeType) |
||
203 | |||
204 | /** |
||
205 | * Get the subject for the given message. |
||
206 | * |
||
207 | * @param \Swift_Mime_SimpleMessage $message |
||
208 | * |
||
209 | * @return string |
||
210 | */ |
||
211 | protected function getSubject(Swift_Mime_SimpleMessage $message) |
||
215 | |||
216 | /** |
||
217 | * Get the tag for the given message. |
||
218 | * |
||
219 | * @param \Swift_Mime_SimpleMessage $message |
||
220 | * |
||
221 | * @return string |
||
222 | */ |
||
223 | protected function getTag(Swift_Mime_SimpleMessage $message) |
||
231 | |||
232 | /** |
||
233 | * Get the HTTP payload for sending the Postmark message. |
||
234 | * |
||
235 | * @param \Swift_Mime_SimpleMessage $message |
||
236 | * |
||
237 | * @return array |
||
238 | */ |
||
239 | protected function payload(Swift_Mime_SimpleMessage $message) |
||
266 | } |
||
267 |
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: