1 | <?php |
||
17 | class GlobeCoordinateValue extends DataValueObject { |
||
18 | |||
19 | /** |
||
20 | * @var LatLongValue |
||
21 | */ |
||
22 | private $latLong; |
||
23 | |||
24 | /** |
||
25 | * The precision of the coordinate in degrees, e.g. 0.01. |
||
26 | * |
||
27 | * @var float|int|null |
||
28 | */ |
||
29 | private $precision; |
||
30 | |||
31 | /** |
||
32 | * IRI of the globe on which the location resides. |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | private $globe; |
||
37 | |||
38 | /** |
||
39 | * Wikidata concept URI for the Earth. Used as default value when no other globe was specified. |
||
40 | */ |
||
41 | const GLOBE_EARTH = 'http://www.wikidata.org/entity/Q2'; |
||
42 | |||
43 | /** |
||
44 | * @param LatLongValue $latLong |
||
45 | * @param float|int|null $precision in degrees, e.g. 0.01. |
||
46 | * @param string|null $globe IRI, defaults to 'http://www.wikidata.org/entity/Q2'. |
||
47 | * |
||
48 | * @throws IllegalValueException |
||
49 | */ |
||
50 | 77 | public function __construct( LatLongValue $latLong, $precision = null, $globe = null ) { |
|
63 | |||
64 | /** |
||
65 | * @see LatLongValue::assertIsLatitude |
||
66 | * @see LatLongValue::assertIsLongitude |
||
67 | * |
||
68 | * @param float|int|null $precision |
||
69 | * |
||
70 | * @throws IllegalValueException |
||
71 | */ |
||
72 | 77 | private function assertIsPrecision( $precision ) { |
|
81 | |||
82 | /** |
||
83 | * @see Serializable::serialize |
||
84 | * |
||
85 | * @return string |
||
86 | */ |
||
87 | 48 | public function serialize() { |
|
90 | |||
91 | /** |
||
92 | * @see Serializable::unserialize |
||
93 | * |
||
94 | * @param string $value |
||
95 | * |
||
96 | * @throws IllegalValueException |
||
97 | */ |
||
98 | 49 | public function unserialize( $value ) { |
|
102 | |||
103 | /** |
||
104 | * @see DataValue::getType |
||
105 | * |
||
106 | * @return string |
||
107 | */ |
||
108 | 32 | public static function getType() { |
|
111 | |||
112 | /** |
||
113 | * @see DataValue::getSortKey |
||
114 | * |
||
115 | * @return float |
||
116 | */ |
||
117 | public function getSortKey() { |
||
120 | |||
121 | /** |
||
122 | * @return float |
||
123 | */ |
||
124 | 18 | public function getLatitude() { |
|
127 | |||
128 | /** |
||
129 | * @return float |
||
130 | */ |
||
131 | 18 | public function getLongitude() { |
|
134 | |||
135 | /** |
||
136 | * @see DataValue::getValue |
||
137 | * |
||
138 | * @return self |
||
139 | */ |
||
140 | 16 | public function getValue() { |
|
143 | |||
144 | /** |
||
145 | * @return LatLongValue |
||
146 | */ |
||
147 | public function getLatLong() { |
||
150 | |||
151 | /** |
||
152 | * Returns the precision of the coordinate in degrees, e.g. 0.01. |
||
153 | * |
||
154 | * @return float|int|null |
||
155 | */ |
||
156 | 18 | public function getPrecision() { |
|
159 | |||
160 | /** |
||
161 | * Returns the IRI of the globe on which the location resides. |
||
162 | * |
||
163 | * @return string |
||
164 | */ |
||
165 | 18 | public function getGlobe() { |
|
168 | |||
169 | /** |
||
170 | * @see Hashable::getHash |
||
171 | * |
||
172 | * @since 2.0 |
||
173 | * |
||
174 | * @return string |
||
175 | */ |
||
176 | 17 | public function getHash() { |
|
182 | |||
183 | /** |
||
184 | * @see DataValue::getArrayValue |
||
185 | * |
||
186 | * @return array |
||
187 | */ |
||
188 | 80 | public function getArrayValue() { |
|
201 | |||
202 | /** |
||
203 | * Constructs a new instance from the provided data. Required for @see DataValueDeserializer. |
||
204 | * This is expected to round-trip with @see getArrayValue. |
||
205 | * |
||
206 | * @deprecated since 2.0.1. Static DataValue::newFromArray constructors like this are |
||
207 | * underspecified (not in the DataValue interface), and misleadingly named (should be named |
||
208 | * newFromArrayValue). Instead, use DataValue builder callbacks in @see DataValueDeserializer. |
||
209 | * |
||
210 | * @param mixed $data Warning! Even if this is expected to be a value as returned by |
||
211 | * @see getArrayValue, callers of this specific newFromArray implementation can not guarantee |
||
212 | * this. This is not even guaranteed to be an array! |
||
213 | * |
||
214 | * @throws IllegalValueException if $data is not in the expected format. Subclasses of |
||
215 | * InvalidArgumentException are expected and properly handled by @see DataValueDeserializer. |
||
216 | * @return self |
||
217 | */ |
||
218 | public static function newFromArray( $data ) { |
||
230 | |||
231 | } |
||
232 |
This checks looks for assignemnts to variables using the
list(...)
function, where not all assigned variables are subsequently used.Consider the following code example.
Only the variables
$a
and$c
are used. There was no need to assign$b
.Instead, the list call could have been.