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 | const GLOBE_EARTH = 'http://www.wikidata.org/entity/Q2'; |
||
39 | |||
40 | /** |
||
41 | * @param LatLongValue $latLong |
||
42 | * @param float|int|null $precision in degrees, e.g. 0.01. |
||
43 | * @param string|null $globe IRI, defaults to 'http://www.wikidata.org/entity/Q2'. |
||
44 | * |
||
45 | * @throws IllegalValueException |
||
46 | */ |
||
47 | public function __construct( LatLongValue $latLong, $precision = null, $globe = null ) { |
||
60 | |||
61 | /** |
||
62 | * @see LatLongValue::assertIsLatitude |
||
63 | * @see LatLongValue::assertIsLongitude |
||
64 | * |
||
65 | * @param float|int|null $precision |
||
66 | * |
||
67 | * @throws IllegalValueException |
||
68 | */ |
||
69 | private function assertIsPrecision( $precision ) { |
||
78 | |||
79 | /** |
||
80 | * @see Serializable::serialize |
||
81 | * |
||
82 | * @return string |
||
83 | */ |
||
84 | public function serialize() { |
||
87 | |||
88 | /** |
||
89 | * @see Serializable::unserialize |
||
90 | * |
||
91 | * @param string $value |
||
92 | * |
||
93 | * @throws IllegalValueException |
||
94 | */ |
||
95 | public function unserialize( $value ) { |
||
99 | |||
100 | /** |
||
101 | * @see DataValue::getType |
||
102 | * |
||
103 | * @return string |
||
104 | */ |
||
105 | public static function getType() { |
||
108 | |||
109 | /** |
||
110 | * @see DataValue::getSortKey |
||
111 | * |
||
112 | * @return float |
||
113 | */ |
||
114 | public function getSortKey() { |
||
117 | |||
118 | /** |
||
119 | * Returns the latitude. |
||
120 | * |
||
121 | * @since 0.1 |
||
122 | * |
||
123 | * @return float |
||
124 | */ |
||
125 | public function getLatitude() { |
||
128 | |||
129 | /** |
||
130 | * Returns the longitude. |
||
131 | * |
||
132 | * @since 0.1 |
||
133 | * |
||
134 | * @return float |
||
135 | */ |
||
136 | public function getLongitude() { |
||
139 | |||
140 | /** |
||
141 | * Returns the text. |
||
142 | * @see DataValue::getValue |
||
143 | * |
||
144 | * @return self |
||
145 | */ |
||
146 | public function getValue() { |
||
149 | |||
150 | /** |
||
151 | * @since 0.1 |
||
152 | * |
||
153 | * @return LatLongValue |
||
154 | */ |
||
155 | public function getLatLong() { |
||
158 | |||
159 | /** |
||
160 | * Returns the precision of the coordinate in degrees, e.g. 0.01. |
||
161 | * |
||
162 | * @since 0.1 |
||
163 | * |
||
164 | * @return float|int|null |
||
165 | */ |
||
166 | public function getPrecision() { |
||
169 | |||
170 | /** |
||
171 | * Returns the IRI of the globe on which the location resides. |
||
172 | * |
||
173 | * @since 0.1 |
||
174 | * |
||
175 | * @return string |
||
176 | */ |
||
177 | public function getGlobe() { |
||
180 | |||
181 | /** |
||
182 | * @see DataValue::getArrayValue |
||
183 | * |
||
184 | * @return array |
||
185 | */ |
||
186 | public function getArrayValue() { |
||
199 | |||
200 | /** |
||
201 | * Constructs a new instance of the DataValue from the provided data. |
||
202 | * This can round-trip with @see getArrayValue |
||
203 | * |
||
204 | * @since 0.1 |
||
205 | * |
||
206 | * @param array $data |
||
207 | * |
||
208 | * @return self |
||
209 | * @throws IllegalValueException |
||
210 | */ |
||
211 | public static function newFromArray( array $data ) { |
||
223 | |||
224 | } |
||
225 |
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.