1 | <?php |
||
20 | class LatLongValue extends DataValueObject { |
||
21 | |||
22 | /** |
||
23 | * The locations latitude. |
||
24 | * |
||
25 | * @var float |
||
26 | */ |
||
27 | protected $latitude; |
||
28 | |||
29 | /** |
||
30 | * The locations longitude. |
||
31 | * |
||
32 | * @var float |
||
33 | */ |
||
34 | protected $longitude; |
||
35 | |||
36 | /** |
||
37 | * @param float|int $latitude |
||
38 | * @param float|int $longitude |
||
39 | * |
||
40 | * @throws InvalidArgumentException |
||
41 | */ |
||
42 | 64 | public function __construct( $latitude, $longitude ) { |
|
57 | |||
58 | /** |
||
59 | * @param float $latitude |
||
60 | */ |
||
61 | 64 | protected function assertIsLatitude( $latitude ) { |
|
70 | |||
71 | /** |
||
72 | * @param float $longitude |
||
73 | */ |
||
74 | 50 | protected function assertIsLongitude( $longitude ) { |
|
83 | |||
84 | /** |
||
85 | * @see Serializable::serialize |
||
86 | * |
||
87 | * @return string |
||
88 | */ |
||
89 | 30 | public function serialize() { |
|
97 | |||
98 | /** |
||
99 | * @see Serializable::unserialize |
||
100 | * |
||
101 | * @param string $value |
||
102 | * |
||
103 | * @throws InvalidArgumentException |
||
104 | */ |
||
105 | 30 | public function unserialize( $value ) { |
|
114 | |||
115 | /** |
||
116 | * @see DataValue::getType |
||
117 | * |
||
118 | * @return string |
||
119 | */ |
||
120 | 20 | public static function getType() { |
|
124 | |||
125 | /** |
||
126 | * @see DataValue::getSortKey |
||
127 | * |
||
128 | * @return float |
||
129 | */ |
||
130 | public function getSortKey() { |
||
133 | |||
134 | /** |
||
135 | * @see DataValue::getValue |
||
136 | * |
||
137 | * @return self |
||
138 | */ |
||
139 | 10 | public function getValue() { |
|
142 | |||
143 | /** |
||
144 | * @return float |
||
145 | */ |
||
146 | 10 | public function getLatitude() { |
|
149 | |||
150 | /** |
||
151 | * @return float |
||
152 | */ |
||
153 | 10 | public function getLongitude() { |
|
156 | |||
157 | /** |
||
158 | * @see DataValue::getArrayValue |
||
159 | * |
||
160 | * @return float[] |
||
161 | */ |
||
162 | 20 | public function getArrayValue() { |
|
168 | |||
169 | /** |
||
170 | * Constructs a new instance from the provided data. Required for @see DataValueDeserializer. |
||
171 | * This is expected to round-trip with @see getArrayValue. |
||
172 | * |
||
173 | * @deprecated since 2.0.1. Static DataValue::newFromArray constructors like this are |
||
174 | * underspecified (not in the DataValue interface), and misleadingly named (should be named |
||
175 | * newFromArrayValue). Instead, use DataValue builder callbacks in @see DataValueDeserializer. |
||
176 | * |
||
177 | * @param mixed $data Warning! Even if this is expected to be a value as returned by |
||
178 | * @see getArrayValue, callers of this specific newFromArray implementation can not guarantee |
||
179 | * this. This is not even guaranteed to be an array! |
||
180 | * |
||
181 | * @throws InvalidArgumentException if $data is not in the expected format. Subclasses of |
||
182 | * InvalidArgumentException are expected and properly handled by @see DataValueDeserializer. |
||
183 | * @return self |
||
184 | */ |
||
185 | public static function newFromArray( $data ) { |
||
190 | |||
191 | } |
||
192 |