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