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 | 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 | private function assertIsPrecision( $precision ) { |
||
81 | |||
82 | /** |
||
83 | * @see Serializable::serialize |
||
84 | * |
||
85 | * @return string |
||
86 | */ |
||
87 | public function serialize() { |
||
90 | |||
91 | /** |
||
92 | * @see Serializable::unserialize |
||
93 | * |
||
94 | * @param string $value |
||
95 | * |
||
96 | * @throws IllegalValueException |
||
97 | */ |
||
98 | public function unserialize( $value ) { |
||
102 | |||
103 | /** |
||
104 | * @see DataValue::getType |
||
105 | * |
||
106 | * @return string |
||
107 | */ |
||
108 | public static function getType() { |
||
111 | |||
112 | /** |
||
113 | * @see DataValue::getSortKey |
||
114 | * |
||
115 | * @return float |
||
116 | */ |
||
117 | public function getSortKey() { |
||
120 | |||
121 | /** |
||
122 | * Returns the latitude. |
||
123 | * |
||
124 | * @since 0.1 |
||
125 | * |
||
126 | * @return float |
||
127 | */ |
||
128 | public function getLatitude() { |
||
131 | |||
132 | /** |
||
133 | * Returns the longitude. |
||
134 | * |
||
135 | * @since 0.1 |
||
136 | * |
||
137 | * @return float |
||
138 | */ |
||
139 | public function getLongitude() { |
||
142 | |||
143 | /** |
||
144 | * Returns the text. |
||
145 | * @see DataValue::getValue |
||
146 | * |
||
147 | * @return self |
||
148 | */ |
||
149 | public function getValue() { |
||
152 | |||
153 | /** |
||
154 | * @since 0.1 |
||
155 | * |
||
156 | * @return LatLongValue |
||
157 | */ |
||
158 | public function getLatLong() { |
||
161 | |||
162 | /** |
||
163 | * Returns the precision of the coordinate in degrees, e.g. 0.01. |
||
164 | * |
||
165 | * @since 0.1 |
||
166 | * |
||
167 | * @return float|int|null |
||
168 | */ |
||
169 | public function getPrecision() { |
||
172 | |||
173 | /** |
||
174 | * Returns the IRI of the globe on which the location resides. |
||
175 | * |
||
176 | * @since 0.1 |
||
177 | * |
||
178 | * @return string |
||
179 | */ |
||
180 | public function getGlobe() { |
||
183 | |||
184 | /** |
||
185 | * @see DataValue::getArrayValue |
||
186 | * |
||
187 | * @return array |
||
188 | */ |
||
189 | public function getArrayValue() { |
||
202 | |||
203 | /** |
||
204 | * Constructs a new instance of the DataValue from the provided data. |
||
205 | * This can round-trip with @see getArrayValue |
||
206 | * |
||
207 | * @since 0.1 |
||
208 | * |
||
209 | * @param array $data |
||
210 | * |
||
211 | * @return self |
||
212 | * @throws IllegalValueException |
||
213 | */ |
||
214 | public static function newFromArray( array $data ) { |
||
226 | |||
227 | } |
||
228 |
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.