1 | <?php |
||
37 | class Domain extends HttpApi |
||
38 | { |
||
39 | /** |
||
40 | * Returns a list of domains on the account. |
||
41 | * |
||
42 | * @return IndexResponse |
||
43 | */ |
||
44 | 1 | public function index(int $limit = 100, int $skip = 0) |
|
57 | |||
58 | /** |
||
59 | * Returns a single domain. |
||
60 | * |
||
61 | * @param string $domain name of the domain |
||
62 | * |
||
63 | * @return ShowResponse|array|ResponseInterface |
||
64 | */ |
||
65 | 1 | public function show(string $domain) |
|
73 | |||
74 | /** |
||
75 | * Creates a new domain for the account. |
||
76 | * See below for spam filtering parameter information. |
||
77 | * {@link https://documentation.mailgun.com/user_manual.html#um-spam-filter}. |
||
78 | * |
||
79 | * @see https://documentation.mailgun.com/en/latest/api-domains.html#domains |
||
80 | * |
||
81 | * @param string $domain name of the domain |
||
82 | * @param string $smtpPass password for SMTP authentication |
||
83 | * @param string $spamAction `disable` or `tag` - inbound spam filtering |
||
84 | * @param bool $wildcard domain will accept email for subdomains |
||
85 | * @param bool $forceDkimAuthority force DKIM authority |
||
86 | * @param string[] $ips an array of ips to be assigned to the domain |
||
87 | * |
||
88 | * @return CreateResponse|array|ResponseInterface |
||
89 | */ |
||
90 | 7 | public function create(string $domain, string $smtpPass = null, string $spamAction = null, bool $wildcard = null, bool $forceDkimAuthority = null, ?array $ips = null) |
|
132 | |||
133 | /** |
||
134 | * Removes a domain from the account. |
||
135 | * WARNING: This action is irreversible! Be cautious! |
||
136 | * |
||
137 | * @param string $domain name of the domain |
||
138 | * |
||
139 | * @return DeleteResponse|array|ResponseInterface |
||
140 | */ |
||
141 | 1 | public function delete(string $domain) |
|
149 | |||
150 | /** |
||
151 | * Returns a list of SMTP credentials for the specified domain. |
||
152 | * |
||
153 | * @param string $domain name of the domain |
||
154 | * @param int $limit Number of credentials to return |
||
155 | * @param int $skip Number of credentials to omit from the list |
||
156 | * |
||
157 | * @return CredentialResponse |
||
158 | */ |
||
159 | public function credentials(string $domain, int $limit = 100, int $skip = 0) |
||
171 | |||
172 | /** |
||
173 | * Create a new SMTP credential pair for the specified domain. |
||
174 | * |
||
175 | * @param string $domain name of the domain |
||
176 | * @param string $login SMTP Username |
||
177 | * @param string $password SMTP Password. Length min 5, max 32. |
||
178 | * |
||
179 | * @return CreateCredentialResponse|array|ResponseInterface |
||
180 | */ |
||
181 | 1 | public function createCredential(string $domain, string $login, string $password) |
|
197 | |||
198 | /** |
||
199 | * Update a set of SMTP credentials for the specified domain. |
||
200 | * |
||
201 | * @param string $domain name of the domain |
||
202 | * @param string $login SMTP Username |
||
203 | * @param string $pass New SMTP Password. Length min 5, max 32. |
||
204 | * |
||
205 | * @return UpdateCredentialResponse|array|ResponseInterface |
||
206 | */ |
||
207 | 1 | public function updateCredential(string $domain, string $login, string $pass) |
|
222 | |||
223 | /** |
||
224 | * Remove a set of SMTP credentials from the specified domain. |
||
225 | * |
||
226 | * @param string $domain name of the domain |
||
227 | * @param string $login SMTP Username |
||
228 | * |
||
229 | * @return DeleteCredentialResponse|array|ResponseInterface |
||
230 | */ |
||
231 | 1 | public function deleteCredential(string $domain, string $login) |
|
246 | |||
247 | /** |
||
248 | * Returns delivery connection settings for the specified domain. |
||
249 | * |
||
250 | * @param string $domain name of the domain |
||
251 | * |
||
252 | * @return ConnectionResponse|ResponseInterface |
||
253 | */ |
||
254 | 1 | public function connection(string $domain) |
|
262 | |||
263 | /** |
||
264 | * Updates the specified delivery connection settings for the specified domain. |
||
265 | * If a parameter is passed in as null, it will not be updated. |
||
266 | * |
||
267 | * @param string $domain name of the domain |
||
268 | * @param bool|null $requireTLS enforces that messages are sent only over a TLS connection |
||
269 | * @param bool|null $noVerify disables TLS certificate and hostname verification |
||
270 | * |
||
271 | * @return UpdateConnectionResponse|array|ResponseInterface |
||
272 | */ |
||
273 | 1 | public function updateConnection(string $domain, ?bool $requireTLS, ?bool $noVerify) |
|
290 | |||
291 | /** |
||
292 | * Returns a single domain. |
||
293 | * |
||
294 | * @param string $domain name of the domain |
||
295 | * |
||
296 | * @return VerifyResponse|array|ResponseInterface |
||
297 | */ |
||
298 | 1 | public function verify(string $domain) |
|
306 | |||
307 | /** |
||
308 | * Returns a domain tracking settings. |
||
309 | * |
||
310 | * @param string $domain name of the domain |
||
311 | * |
||
312 | * @return TrackingResponse|array|ResponseInterface |
||
313 | */ |
||
314 | 1 | public function tracking(string $domain) |
|
322 | |||
323 | /** |
||
324 | * Updates a domain click tracking settings. |
||
325 | * |
||
326 | * @param string $domain The name of the domain |
||
327 | * @param string $active The status for this tracking (one of: yes, no) |
||
328 | * |
||
329 | * @return UpdateClickTrackingResponse|array|ResponseInterface |
||
330 | * |
||
331 | * @throws \Exception |
||
332 | */ |
||
333 | 4 | public function updateClickTracking(string $domain, string $active) |
|
347 | |||
348 | /** |
||
349 | * Updates a domain open tracking settings. |
||
350 | * |
||
351 | * @param string $domain The name of the domain |
||
352 | * @param string $active The status for this tracking (one of: yes, no) |
||
353 | * |
||
354 | * @return UpdateOpenTrackingResponse|array|ResponseInterface |
||
355 | */ |
||
356 | 3 | public function updateOpenTracking(string $domain, string $active) |
|
370 | |||
371 | /** |
||
372 | * Updates a domain unsubscribe tracking settings. |
||
373 | * |
||
374 | * @param string $domain The name of the domain |
||
375 | * @param string $active The status for this tracking (one of: yes, no) |
||
376 | * @param string $htmlFooter The footer for HTML emails |
||
377 | * @param string $textFooter The footer for plain text emails |
||
378 | * |
||
379 | * @return UpdateUnsubscribeTrackingResponse|array|ResponseInterface |
||
380 | * |
||
381 | * @throws \Exception |
||
382 | */ |
||
383 | 3 | public function updateUnsubscribeTracking(string $domain, string $active, string $htmlFooter, string $textFooter) |
|
401 | } |
||
402 |
Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.
Let’s take a look at an example:
As you can see in this example, the array
$myArray
is initialized the first time when the foreach loop is entered. You can also see that the value of thebar
key is only written conditionally; thus, its value might result from a previous iteration.This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.