1 | <?php |
||
47 | class LocationProperties extends AbstractProperties |
||
48 | { |
||
49 | /** |
||
50 | * Latitude |
||
51 | * |
||
52 | * @var string |
||
53 | */ |
||
54 | const LATITUDE = 'latitude'; |
||
55 | /** |
||
56 | * Latitude |
||
57 | * |
||
58 | * @var string |
||
59 | */ |
||
60 | const LONGITUDE = 'longitude'; |
||
61 | /** |
||
62 | * Elevation |
||
63 | * |
||
64 | * @var string |
||
65 | */ |
||
66 | const ELEVATION = 'elevation'; |
||
67 | /** |
||
68 | * Latitude |
||
69 | * |
||
70 | * @var float |
||
71 | */ |
||
72 | protected $latitude = null; |
||
73 | /** |
||
74 | * Longitude |
||
75 | * |
||
76 | * @var float |
||
77 | */ |
||
78 | protected $longitude = null; |
||
79 | /** |
||
80 | * Elevation |
||
81 | * |
||
82 | * @var float |
||
83 | */ |
||
84 | protected $elevation = null; |
||
85 | |||
86 | /** |
||
87 | * Location constructor |
||
88 | * |
||
89 | * @param array $data Property data |
||
90 | * @param ObjectInterface $object Owner object |
||
91 | */ |
||
92 | 22 | public function __construct(array $data, ObjectInterface $object) |
|
111 | |||
112 | /** |
||
113 | * Validate a location value |
||
114 | * |
||
115 | * @param float|null $value Location property value |
||
116 | * @return boolean Location value validity |
||
117 | * @throws InvalidArgumentException If the location property value is not a float |
||
118 | */ |
||
119 | 1 | protected function validateLocationProperty($value) |
|
131 | |||
132 | /** |
||
133 | * Return the latitude |
||
134 | * |
||
135 | * @return float Latitude |
||
136 | */ |
||
137 | 1 | public function getLatitude() |
|
141 | |||
142 | /** |
||
143 | * Set the latitude |
||
144 | * |
||
145 | * @param float $latitude Latitude |
||
146 | * @return LocationProperties Self reference |
||
147 | */ |
||
148 | 1 | public function setLatitude($latitude) |
|
153 | |||
154 | /** |
||
155 | * Return the longitude |
||
156 | * |
||
157 | * @return float Longitude |
||
158 | */ |
||
159 | 1 | public function getLongitude() |
|
163 | |||
164 | /** |
||
165 | * Set the longitude |
||
166 | * |
||
167 | * @param float $longitude Longitude |
||
168 | * @return LocationProperties Self reference |
||
169 | */ |
||
170 | 1 | public function setLongitude($longitude) |
|
175 | |||
176 | /** |
||
177 | * Return the elevation |
||
178 | * |
||
179 | * @return float Elevation |
||
180 | */ |
||
181 | public function getElevation() |
||
185 | |||
186 | /** |
||
187 | * Set the elevation |
||
188 | * |
||
189 | * @param float $elevation |
||
190 | * @return LocationProperties Self reference |
||
191 | */ |
||
192 | 1 | public function setElevation($elevation) |
|
197 | |||
198 | /** |
||
199 | * Return the location values as array |
||
200 | * |
||
201 | * @return array LocationProperties values |
||
202 | */ |
||
203 | 5 | public function toArray() |
|
211 | } |
||
212 |