1 | <?php |
||
33 | class Domain extends HttpApi |
||
34 | { |
||
35 | /** |
||
36 | * Returns a list of domains on the account. |
||
37 | * |
||
38 | * |
||
39 | * @return IndexResponse |
||
40 | */ |
||
41 | 1 | public function index(int $limit = 100, int $skip = 0) |
|
54 | |||
55 | /** |
||
56 | * Returns a single domain. |
||
57 | * |
||
58 | * @param string $domain name of the domain |
||
59 | * |
||
60 | * @return ShowResponse|array|ResponseInterface |
||
61 | */ |
||
62 | 1 | public function show(string $domain) |
|
70 | |||
71 | /** |
||
72 | * Creates a new domain for the account. |
||
73 | * See below for spam filtering parameter information. |
||
74 | * {@link https://documentation.mailgun.com/user_manual.html#um-spam-filter}. |
||
75 | * |
||
76 | * @see https://documentation.mailgun.com/en/latest/api-domains.html#domains |
||
77 | * |
||
78 | * @param string $domain name of the domain |
||
79 | * @param string $smtpPass password for SMTP authentication |
||
80 | * @param string $spamAction `disable` or `tag` - inbound spam filtering |
||
81 | * @param bool $wildcard domain will accept email for subdomains |
||
82 | * |
||
83 | * @return CreateResponse|array|ResponseInterface |
||
84 | */ |
||
85 | 4 | public function create(string $domain, string $smtpPass = null, string $spamAction = null, bool $wildcard = null) |
|
114 | |||
115 | /** |
||
116 | * Removes a domain from the account. |
||
117 | * WARNING: This action is irreversible! Be cautious! |
||
118 | * |
||
119 | * @param string $domain name of the domain |
||
120 | * |
||
121 | * @return DeleteResponse|array|ResponseInterface |
||
122 | */ |
||
123 | 1 | public function delete(string $domain) |
|
131 | |||
132 | /** |
||
133 | * Returns a list of SMTP credentials for the specified domain. |
||
134 | * |
||
135 | * @param string $domain name of the domain |
||
136 | * @param int $limit Number of credentials to return |
||
137 | * @param int $skip Number of credentials to omit from the list |
||
138 | * |
||
139 | * @return CredentialResponse |
||
140 | */ |
||
141 | public function credentials(string $domain, int $limit = 100, int $skip = 0) |
||
153 | |||
154 | /** |
||
155 | * Create a new SMTP credential pair for the specified domain. |
||
156 | * |
||
157 | * @param string $domain name of the domain |
||
158 | * @param string $login SMTP Username |
||
159 | * @param string $password SMTP Password. Length min 5, max 32. |
||
160 | * |
||
161 | * @return CreateCredentialResponse|array|ResponseInterface |
||
162 | */ |
||
163 | 1 | public function createCredential(string $domain, string $login, string $password) |
|
179 | |||
180 | /** |
||
181 | * Update a set of SMTP credentials for the specified domain. |
||
182 | * |
||
183 | * @param string $domain name of the domain |
||
184 | * @param string $login SMTP Username |
||
185 | * @param string $pass New SMTP Password. Length min 5, max 32. |
||
186 | * |
||
187 | * @return UpdateCredentialResponse|array|ResponseInterface |
||
188 | */ |
||
189 | 1 | public function updateCredential(string $domain, string $login, string $pass) |
|
204 | |||
205 | /** |
||
206 | * Remove a set of SMTP credentials from the specified domain. |
||
207 | * |
||
208 | * @param string $domain name of the domain |
||
209 | * @param string $login SMTP Username |
||
210 | * |
||
211 | * @return DeleteCredentialResponse|array|ResponseInterface |
||
212 | */ |
||
213 | 1 | public function deleteCredential(string $domain, string $login) |
|
228 | |||
229 | /** |
||
230 | * Returns delivery connection settings for the specified domain. |
||
231 | * |
||
232 | * @param string $domain name of the domain |
||
233 | * |
||
234 | * @return ConnectionResponse|ResponseInterface |
||
235 | */ |
||
236 | 1 | public function connection(string $domain) |
|
244 | |||
245 | /** |
||
246 | * Updates the specified delivery connection settings for the specified domain. |
||
247 | * If a parameter is passed in as null, it will not be updated. |
||
248 | * |
||
249 | * @param string $domain name of the domain |
||
250 | * @param bool|null $requireTLS enforces that messages are sent only over a TLS connection |
||
251 | * @param bool|null $noVerify disables TLS certificate and hostname verification |
||
252 | * |
||
253 | * @return UpdateConnectionResponse|array|ResponseInterface |
||
254 | */ |
||
255 | 1 | public function updateConnection(string $domain, ?bool $requireTLS, ?bool $noVerify) |
|
272 | |||
273 | /** |
||
274 | * Returns a single domain. |
||
275 | * |
||
276 | * @param string $domain name of the domain |
||
277 | * |
||
278 | * @return VerifyResponse|array|ResponseInterface |
||
279 | */ |
||
280 | 1 | public function verify(string $domain) |
|
288 | } |
||
289 |
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.