1 | <?php |
||
9 | abstract class Message implements MessageContract |
||
10 | { |
||
11 | /** |
||
12 | * Get message id. |
||
13 | * |
||
14 | * @return string |
||
15 | */ |
||
16 | public function getId() |
||
24 | |||
25 | /** |
||
26 | * Get payload. |
||
27 | * |
||
28 | * @return array |
||
29 | */ |
||
30 | public function getPayload() |
||
38 | |||
39 | /** |
||
40 | * Get the recorded date. |
||
41 | * |
||
42 | * @return Datetime |
||
43 | */ |
||
44 | public function getRecordedDate() |
||
52 | |||
53 | /** |
||
54 | * Get the message name (e.g. the type). |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | public function getName() |
||
62 | } |
||
63 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: