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 | 2 | public function create(string $domain, string $smtpPass = null, string $spamAction = null, bool $wildcard = null) |
|
105 | |||
106 | /** |
||
107 | * Removes a domain from the account. |
||
108 | * WARNING: This action is irreversible! Be cautious! |
||
109 | * |
||
110 | * @param string $domain name of the domain |
||
111 | * |
||
112 | * @return DeleteResponse|array|ResponseInterface |
||
113 | */ |
||
114 | 1 | public function delete(string $domain) |
|
122 | |||
123 | /** |
||
124 | * Returns a list of SMTP credentials for the specified domain. |
||
125 | * |
||
126 | * @param string $domain name of the domain |
||
127 | * @param int $limit Number of credentials to return |
||
128 | * @param int $skip Number of credentials to omit from the list |
||
129 | * |
||
130 | * @return CredentialResponse |
||
131 | */ |
||
132 | public function credentials(string $domain, int $limit = 100, int $skip = 0) |
||
144 | |||
145 | /** |
||
146 | * Create a new SMTP credential pair for the specified domain. |
||
147 | * |
||
148 | * @param string $domain name of the domain |
||
149 | * @param string $login SMTP Username |
||
150 | * @param string $password SMTP Password. Length min 5, max 32. |
||
151 | * |
||
152 | * @return CreateCredentialResponse|array|ResponseInterface |
||
153 | */ |
||
154 | 1 | public function createCredential(string $domain, string $login, string $password) |
|
170 | |||
171 | /** |
||
172 | * Update a set of SMTP credentials for the specified domain. |
||
173 | * |
||
174 | * @param string $domain name of the domain |
||
175 | * @param string $login SMTP Username |
||
176 | * @param string $pass New SMTP Password. Length min 5, max 32. |
||
177 | * |
||
178 | * @return UpdateCredentialResponse|array|ResponseInterface |
||
179 | */ |
||
180 | 1 | public function updateCredential(string $domain, string $login, string $pass) |
|
195 | |||
196 | /** |
||
197 | * Remove a set of SMTP credentials from the specified domain. |
||
198 | * |
||
199 | * @param string $domain name of the domain |
||
200 | * @param string $login SMTP Username |
||
201 | * |
||
202 | * @return DeleteCredentialResponse|array|ResponseInterface |
||
203 | */ |
||
204 | 1 | public function deleteCredential(string $domain, string $login) |
|
219 | |||
220 | /** |
||
221 | * Returns delivery connection settings for the specified domain. |
||
222 | * |
||
223 | * @param string $domain name of the domain |
||
224 | * |
||
225 | * @return ConnectionResponse|ResponseInterface |
||
226 | */ |
||
227 | 1 | public function connection(string $domain) |
|
235 | |||
236 | /** |
||
237 | * Updates the specified delivery connection settings for the specified domain. |
||
238 | * If a parameter is passed in as null, it will not be updated. |
||
239 | * |
||
240 | * @param string $domain name of the domain |
||
241 | * @param bool|null $requireTLS enforces that messages are sent only over a TLS connection |
||
242 | * @param bool|null $noVerify disables TLS certificate and hostname verification |
||
243 | * |
||
244 | * @return UpdateConnectionResponse|array|ResponseInterface |
||
245 | */ |
||
246 | 1 | public function updateConnection(string $domain, ?bool $requireTLS, ?bool $noVerify) |
|
263 | |||
264 | /** |
||
265 | * Returns a single domain. |
||
266 | * |
||
267 | * @param string $domain name of the domain |
||
268 | * |
||
269 | * @return VerifyResponse|array|ResponseInterface |
||
270 | */ |
||
271 | 1 | public function verify(string $domain) |
|
279 | } |
||
280 |
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.