1 | <?php |
||
27 | class Complaint extends HttpApi |
||
28 | { |
||
29 | use Pagination; |
||
30 | |||
31 | /** |
||
32 | * @param string $domain Domain to get complaints for |
||
33 | * @param int $limit optional |
||
34 | * |
||
35 | * @return IndexResponse |
||
36 | */ |
||
37 | 1 | public function index(string $domain, int $limit = 100) |
|
50 | |||
51 | /** |
||
52 | * @param string $domain Domain to show complaint for |
||
53 | * @param string $address Complaint address |
||
54 | * |
||
55 | * @return ShowResponse |
||
56 | */ |
||
57 | 1 | public function show(string $domain, string $address) |
|
65 | |||
66 | /** |
||
67 | * @param string $domain Domain to create complaint for |
||
68 | * @param string $address Complaint address |
||
69 | * @param string $createdAt (optional) rfc2822 compliant format. (new \DateTime())->format('r') |
||
70 | * |
||
71 | * @return CreateResponse |
||
72 | */ |
||
73 | 1 | public function create(string $domain, string $address, string $createdAt = null) |
|
88 | |||
89 | /** |
||
90 | * @param string $domain Domain to delete complaint for |
||
91 | * @param string $address Complaint address |
||
92 | * |
||
93 | * @return DeleteResponse |
||
94 | */ |
||
95 | 1 | public function delete(string $domain, string $address) |
|
104 | |||
105 | /** |
||
106 | * @param string $domain Domain to delete all bounces for |
||
107 | * |
||
108 | * @return DeleteResponse |
||
109 | */ |
||
110 | 1 | public function deleteAll(string $domain) |
|
118 | } |
||
119 |
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.