1 | <?php |
||
16 | class GlobeCoordinateValue extends DataValueObject { |
||
17 | |||
18 | /** |
||
19 | * @var LatLongValue |
||
20 | */ |
||
21 | private $latLong; |
||
22 | |||
23 | /** |
||
24 | * The precision of the coordinate in degrees, e.g. 0.01. |
||
25 | * |
||
26 | * @var float|int|null |
||
27 | */ |
||
28 | private $precision; |
||
29 | |||
30 | /** |
||
31 | * IRI of the globe on which the location resides. |
||
32 | * |
||
33 | * @var string |
||
34 | */ |
||
35 | private $globe; |
||
36 | |||
37 | /** |
||
38 | * Wikidata concept URI for the Earth. Used as default value when no other globe was specified. |
||
39 | */ |
||
40 | const GLOBE_EARTH = 'http://www.wikidata.org/entity/Q2'; |
||
41 | |||
42 | /** |
||
43 | * @param LatLongValue $latLong |
||
44 | * @param float|int|null $precision in degrees, e.g. 0.01. |
||
45 | * @param string|null $globe IRI, defaults to 'http://www.wikidata.org/entity/Q2'. |
||
46 | * |
||
47 | * @throws IllegalValueException |
||
48 | */ |
||
49 | public function __construct( LatLongValue $latLong, $precision, $globe = null ) { |
||
61 | |||
62 | /** |
||
63 | * @param float|int|null $precision |
||
64 | */ |
||
65 | protected function assertIsPrecision( $precision ) { |
||
70 | |||
71 | /** |
||
72 | * @param string $globe |
||
73 | */ |
||
74 | protected function assertIsGlobe( $globe ) { |
||
79 | |||
80 | /** |
||
81 | * @see Serializable::serialize |
||
82 | * |
||
83 | * @return string |
||
84 | */ |
||
85 | public function serialize() { |
||
88 | |||
89 | /** |
||
90 | * @see Serializable::unserialize |
||
91 | * |
||
92 | * @param string $value |
||
93 | * |
||
94 | * @throws IllegalValueException |
||
95 | */ |
||
96 | public function unserialize( $value ) { |
||
100 | |||
101 | /** |
||
102 | * @see DataValue::getType |
||
103 | * |
||
104 | * @return string |
||
105 | */ |
||
106 | public static function getType() { |
||
109 | |||
110 | /** |
||
111 | * @see DataValue::getSortKey |
||
112 | * |
||
113 | * @return float |
||
114 | */ |
||
115 | public function getSortKey() { |
||
118 | |||
119 | /** |
||
120 | * @since 0.1 |
||
121 | * |
||
122 | * @return float |
||
123 | */ |
||
124 | public function getLatitude() { |
||
127 | |||
128 | /** |
||
129 | * @since 0.1 |
||
130 | * |
||
131 | * @return float |
||
132 | */ |
||
133 | public function getLongitude() { |
||
136 | |||
137 | /** |
||
138 | * @see DataValue::getValue |
||
139 | * |
||
140 | * @return self |
||
141 | */ |
||
142 | public function getValue() { |
||
145 | |||
146 | /** |
||
147 | * @since 0.1 |
||
148 | * |
||
149 | * @return LatLongValue |
||
150 | */ |
||
151 | public function getLatLong() { |
||
154 | |||
155 | /** |
||
156 | * Returns the precision of the coordinate in degrees, e.g. 0.01. |
||
157 | * |
||
158 | * @since 0.1 |
||
159 | * |
||
160 | * @return float|int|null |
||
161 | */ |
||
162 | public function getPrecision() { |
||
165 | |||
166 | /** |
||
167 | * Returns the IRI of the globe on which the location resides. |
||
168 | * |
||
169 | * @since 0.1 |
||
170 | * |
||
171 | * @return string |
||
172 | */ |
||
173 | public function getGlobe() { |
||
176 | |||
177 | /** |
||
178 | * @see Hashable::getHash |
||
179 | * |
||
180 | * @return string |
||
181 | */ |
||
182 | public function getHash() { |
||
188 | |||
189 | /** |
||
190 | * @see DataValue::getArrayValue |
||
191 | * |
||
192 | * @return array |
||
193 | */ |
||
194 | public function getArrayValue() { |
||
207 | |||
208 | /** |
||
209 | * Constructs a new instance of the DataValue from the provided data. |
||
210 | * This can round-trip with @see getArrayValue |
||
211 | * |
||
212 | * @since 0.1 |
||
213 | * |
||
214 | * @param array $data |
||
215 | * |
||
216 | * @return self |
||
217 | * @throws IllegalValueException |
||
218 | */ |
||
219 | public static function newFromArray( array $data ) { |
||
231 | |||
232 | } |
||
233 |
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.