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