1 | <?php |
||
50 | trait SystemPropertiesTrait |
||
51 | { |
||
52 | /** |
||
53 | * System properties |
||
54 | * |
||
55 | * @var SystemProperties |
||
56 | */ |
||
57 | protected $systemProperties; |
||
58 | |||
59 | /** |
||
60 | * Return the object revision |
||
61 | * |
||
62 | * @return Revision Object revision |
||
63 | */ |
||
64 | 20 | public function getRevision() |
|
68 | |||
69 | /** |
||
70 | * Return the object ID |
||
71 | * |
||
72 | * @return Id Object ID |
||
73 | */ |
||
74 | 5 | public function getId() |
|
78 | |||
79 | /** |
||
80 | * Return the object type |
||
81 | * |
||
82 | * @return Type Object type |
||
83 | */ |
||
84 | 1 | public function getType() |
|
88 | |||
89 | /** |
||
90 | * Return the creation date & time |
||
91 | * |
||
92 | * @return \DateTimeImmutable Creation date & time |
||
93 | */ |
||
94 | 1 | public function getCreated() |
|
98 | |||
99 | /** |
||
100 | * Return the publication date & time |
||
101 | * |
||
102 | * @return \DateTimeImmutable|null Publication date & time |
||
103 | */ |
||
104 | 1 | public function getPublished() |
|
108 | |||
109 | /** |
||
110 | * Return the object hash |
||
111 | * |
||
112 | * @return string Object hash |
||
113 | */ |
||
114 | 1 | public function getHash() |
|
118 | |||
119 | /** |
||
120 | * Return the latitude |
||
121 | * |
||
122 | * @return float Latitude |
||
123 | */ |
||
124 | 1 | public function getLatitude() |
|
128 | |||
129 | /** |
||
130 | * Set the latitude |
||
131 | * |
||
132 | * @param float $latitude Latitude |
||
133 | * @return SystemProperties Self reference |
||
134 | */ |
||
135 | 1 | public function setLatitude($latitude) |
|
140 | |||
141 | /** |
||
142 | * Set the system properties collection |
||
143 | * |
||
144 | * @param SystemProperties $systemProperties System property collection |
||
145 | * @param bool $overwrite Overwrite the existing collection (if present) |
||
146 | */ |
||
147 | 1 | protected function setSystemProperties(SystemProperties $systemProperties, $overwrite = false) |
|
163 | |||
164 | /** |
||
165 | * Return the longitude |
||
166 | * |
||
167 | * @return float Longitude |
||
168 | */ |
||
169 | 1 | public function getLongitude() |
|
173 | |||
174 | /** |
||
175 | * Set the longitude |
||
176 | * |
||
177 | * @param float $longitude Longitude |
||
178 | * @return SystemProperties Self reference |
||
179 | */ |
||
180 | 1 | public function setLongitude($longitude) |
|
185 | |||
186 | /** |
||
187 | * Return the elevation |
||
188 | * |
||
189 | * @return float Elevation |
||
190 | */ |
||
191 | public function getElevation() |
||
195 | |||
196 | /** |
||
197 | * Set the elevation |
||
198 | * |
||
199 | * @param float $elevation |
||
200 | * @return SystemProperties Self reference |
||
201 | */ |
||
202 | 1 | public function setElevation($elevation) |
|
207 | |||
208 | /** |
||
209 | * Set the object state to dirty |
||
210 | */ |
||
211 | abstract protected function setDirtyState(); |
||
212 | } |
||
213 |
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: