1 | <?php |
||
11 | class PostmarkTransport extends Transport |
||
12 | { |
||
13 | /** |
||
14 | * Guzzle client instance. |
||
15 | * |
||
16 | * @var \GuzzleHttp\ClientInterface |
||
17 | */ |
||
18 | protected $client; |
||
19 | |||
20 | /** |
||
21 | * The Postmark API key. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $key; |
||
26 | |||
27 | /** |
||
28 | * The Postmark API end-point. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $url = 'https://api.postmarkapp.com/email'; |
||
33 | |||
34 | /** |
||
35 | * Create a new Postmark transport instance. |
||
36 | * |
||
37 | * @param \GuzzleHttp\ClientInterface $client |
||
38 | * @param string $key |
||
39 | * |
||
40 | * @return void |
||
41 | */ |
||
42 | 29 | public function __construct(ClientInterface $client, $key) |
|
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | */ |
||
51 | 1 | public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) |
|
66 | |||
67 | /** |
||
68 | * Get all attachments for the given message. |
||
69 | * |
||
70 | * @param \Swift_Mime_SimpleMessage $message |
||
71 | * |
||
72 | * @return array |
||
73 | */ |
||
74 | 19 | protected function getAttachments(Swift_Mime_SimpleMessage $message) |
|
90 | |||
91 | /** |
||
92 | * Format the display name. |
||
93 | * |
||
94 | * @param string |
||
95 | * @return string |
||
96 | */ |
||
97 | 7 | protected function getDisplayname($value) |
|
105 | |||
106 | /** |
||
107 | * Format the contacts for the API request. |
||
108 | * |
||
109 | * @param string|array $contacts |
||
110 | * |
||
111 | * @return string |
||
112 | */ |
||
113 | 19 | protected function getContacts($contacts) |
|
122 | |||
123 | /** |
||
124 | * Get the message ID from the response. |
||
125 | * |
||
126 | * @param \GuzzleHttp\Psr7\Response $response |
||
127 | * |
||
128 | * @return string |
||
129 | */ |
||
130 | 1 | protected function getMessageId($response) |
|
137 | |||
138 | /** |
||
139 | * Get the body for the given message. |
||
140 | * |
||
141 | * @param \Swift_Mime_SimpleMessage $message |
||
142 | * |
||
143 | * @return string |
||
144 | */ |
||
145 | 20 | protected function getBody(Swift_Mime_SimpleMessage $message) |
|
149 | |||
150 | /** |
||
151 | * Get the text and html fields for the given message. |
||
152 | * |
||
153 | * @param \Swift_Mime_SimpleMessage $message |
||
154 | * |
||
155 | * @return array |
||
156 | */ |
||
157 | 18 | protected function getHtmlAndTextBody(Swift_Mime_SimpleMessage $message) |
|
175 | |||
176 | /** |
||
177 | * Get a mime part from the given message. |
||
178 | * |
||
179 | * @param \Swift_Mime_SimpleMessage $message |
||
180 | * @param string $mimeType |
||
181 | * |
||
182 | * @return \Swift_MimePart|null |
||
183 | */ |
||
184 | 19 | protected function getMimePart(Swift_Mime_SimpleMessage $message, $mimeType) |
|
195 | |||
196 | /** |
||
197 | * Get the subject for the given message. |
||
198 | * |
||
199 | * @param \Swift_Mime_SimpleMessage $message |
||
200 | * |
||
201 | * @return string |
||
202 | */ |
||
203 | 20 | protected function getSubject(Swift_Mime_SimpleMessage $message) |
|
207 | |||
208 | /** |
||
209 | * Get the tag for the given message. |
||
210 | * |
||
211 | * @param \Swift_Mime_SimpleMessage $message |
||
212 | * |
||
213 | * @return string |
||
214 | */ |
||
215 | 21 | protected function getTag(Swift_Mime_SimpleMessage $message) |
|
223 | |||
224 | /** |
||
225 | * Get the HTTP payload for sending the Postmark message. |
||
226 | * |
||
227 | * @param \Swift_Mime_SimpleMessage $message |
||
228 | * |
||
229 | * @return array |
||
230 | */ |
||
231 | 18 | protected function payload(Swift_Mime_SimpleMessage $message) |
|
258 | } |
||
259 |
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: