1 | <?php |
||
7 | class TrackingStatus |
||
8 | { |
||
9 | use ReadableAttributes { |
||
10 | mayHaveAsString as public getStatusDetails; |
||
11 | toArray as __toArray; |
||
12 | } |
||
13 | |||
14 | /** |
||
15 | * Date and time of object creation. |
||
16 | * |
||
17 | * @return \DateTime |
||
18 | */ |
||
19 | public function getObjectCreated() |
||
23 | |||
24 | /** |
||
25 | * Date and time of last object update. |
||
26 | * |
||
27 | * @return \DateTime |
||
28 | */ |
||
29 | public function getObjectUpdated() |
||
33 | |||
34 | /** |
||
35 | * Date and time when the carrier has scanned this tracking event. |
||
36 | * |
||
37 | * @return \DateTime |
||
38 | */ |
||
39 | public function getStatusDate() |
||
43 | |||
44 | /** |
||
45 | * Unique identifier of the given object. |
||
46 | * |
||
47 | * @return string |
||
48 | */ |
||
49 | public function getObjectId() |
||
53 | |||
54 | /** |
||
55 | * Package status. |
||
56 | * - "UNKNOWN" The package has not been found via the carrier's tracking system, |
||
57 | * or it has been found but not yet scanned by the carrier. |
||
58 | * - "TRANSIT" The package has been scanned by the carrier and is in transit. |
||
59 | * - "DELIVERED" The package has been successfully delivered. |
||
60 | * - "RETURNED" The package is en route to be returned to the sender, or has been returned successfully. |
||
61 | * - "FAILURE" The carrier indicated that there has been an issue with the delivery. |
||
62 | * This can happen for various reasons and depends on the carrier. |
||
63 | * This status does not indicate a technical error, but rather a delivery issue. |
||
64 | * |
||
65 | * @return string |
||
66 | */ |
||
67 | public function getStatus() |
||
71 | |||
72 | /** |
||
73 | * @return Location |
||
74 | */ |
||
75 | public function getLocation() |
||
80 | |||
81 | public function toArray() |
||
93 | } |
||
94 |
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: