This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Bpost\BpostApiClient\Geo6; |
||
4 | |||
5 | use Bpost\BpostApiClient\Exception\BpostApiResponseException\BpostInvalidXmlResponseException; |
||
6 | |||
7 | /** |
||
8 | * Geo6 class |
||
9 | * |
||
10 | * @author Tijs Verkoyen <[email protected]> |
||
11 | * @version 3.0.0 |
||
12 | * @copyright Copyright (c), Tijs Verkoyen. All rights reserved. |
||
13 | * @license BSD License |
||
14 | */ |
||
15 | class Poi |
||
16 | { |
||
17 | /** @var string */ |
||
18 | private $id; |
||
19 | |||
20 | /** @var string */ |
||
21 | private $type; |
||
22 | |||
23 | /** @var string */ |
||
24 | private $office; |
||
25 | |||
26 | /** @var string */ |
||
27 | private $street; |
||
28 | |||
29 | /** @var string */ |
||
30 | private $nr; |
||
0 ignored issues
–
show
|
|||
31 | |||
32 | /** @var string */ |
||
33 | private $zip; |
||
34 | |||
35 | /** @var string */ |
||
36 | private $city; |
||
37 | |||
38 | /** @var int */ |
||
39 | private $x; |
||
0 ignored issues
–
show
|
|||
40 | |||
41 | /** @var int */ |
||
42 | private $y; |
||
0 ignored issues
–
show
|
|||
43 | |||
44 | /** @var float */ |
||
45 | private $latitude; |
||
46 | |||
47 | /** @var float */ |
||
48 | private $longitude; |
||
49 | |||
50 | /** @var array */ |
||
51 | private $services; |
||
52 | |||
53 | /** @var array */ |
||
54 | private $hours; |
||
55 | |||
56 | /** @var array */ |
||
57 | private $closedFrom; |
||
58 | |||
59 | /** @var array */ |
||
60 | private $closedTo; |
||
61 | |||
62 | /** @var string */ |
||
63 | private $note; |
||
64 | |||
65 | /** @var string */ |
||
66 | private $page; |
||
67 | |||
68 | /** |
||
69 | * @param string $city |
||
70 | */ |
||
71 | 3 | public function setCity($city) |
|
72 | { |
||
73 | 3 | $this->city = (string)$city; |
|
74 | 3 | } |
|
75 | |||
76 | /** |
||
77 | * @return string |
||
78 | */ |
||
79 | 1 | public function getCity() |
|
80 | { |
||
81 | 1 | return $this->city; |
|
82 | } |
||
83 | |||
84 | /** |
||
85 | * @param array $closedFrom |
||
86 | */ |
||
87 | public function setClosedFrom(array $closedFrom) |
||
88 | { |
||
89 | $this->closedFrom = $closedFrom; |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * @return array |
||
94 | */ |
||
95 | 1 | public function getClosedFrom() |
|
96 | { |
||
97 | 1 | return $this->closedFrom; |
|
98 | } |
||
99 | |||
100 | /** |
||
101 | * @param array $closedTo |
||
102 | */ |
||
103 | public function setClosedTo(array $closedTo) |
||
104 | { |
||
105 | $this->closedTo = $closedTo; |
||
106 | } |
||
107 | |||
108 | /** |
||
109 | * @return array |
||
110 | */ |
||
111 | 1 | public function getClosedTo() |
|
112 | { |
||
113 | 1 | return $this->closedTo; |
|
114 | } |
||
115 | |||
116 | /** |
||
117 | * @param int $index |
||
118 | * @param Day $day |
||
119 | */ |
||
120 | 2 | public function addHour($index, Day $day) |
|
121 | { |
||
122 | 2 | $this->hours[(int)$index] = $day; |
|
123 | 2 | } |
|
124 | |||
125 | /** |
||
126 | * @param Day[] $hours |
||
127 | */ |
||
128 | public function setHours(array $hours) |
||
129 | { |
||
130 | $this->hours = $hours; |
||
131 | } |
||
132 | |||
133 | /** |
||
134 | * @return Day[] |
||
135 | */ |
||
136 | 1 | public function getHours() |
|
137 | { |
||
138 | 1 | return $this->hours; |
|
139 | } |
||
140 | |||
141 | /** |
||
142 | * @param string $id |
||
143 | */ |
||
144 | 3 | public function setId($id) |
|
145 | { |
||
146 | 3 | $this->id = (string)$id; |
|
147 | 3 | } |
|
148 | |||
149 | /** |
||
150 | * @return string |
||
151 | */ |
||
152 | 2 | public function getId() |
|
153 | { |
||
154 | 2 | return $this->id; |
|
155 | } |
||
156 | |||
157 | /** |
||
158 | * @param float $latitude |
||
159 | */ |
||
160 | 3 | public function setLatitude($latitude) |
|
161 | { |
||
162 | 3 | $this->latitude = (float)$latitude; |
|
163 | 3 | } |
|
164 | |||
165 | /** |
||
166 | * @return float |
||
167 | */ |
||
168 | 1 | public function getLatitude() |
|
169 | { |
||
170 | 1 | return $this->latitude; |
|
171 | } |
||
172 | |||
173 | /** |
||
174 | * @param float $longitude |
||
175 | */ |
||
176 | 3 | public function setLongitude($longitude) |
|
177 | { |
||
178 | 3 | $this->longitude = (float)$longitude; |
|
179 | 3 | } |
|
180 | |||
181 | /** |
||
182 | * @return float |
||
183 | */ |
||
184 | 1 | public function getLongitude() |
|
185 | { |
||
186 | 1 | return $this->longitude; |
|
187 | } |
||
188 | |||
189 | /** |
||
190 | * @param string $note |
||
191 | */ |
||
192 | public function setNote($note) |
||
193 | { |
||
194 | $this->note = (string)$note; |
||
195 | } |
||
196 | |||
197 | /** |
||
198 | * @return string |
||
199 | */ |
||
200 | 1 | public function getNote() |
|
201 | { |
||
202 | 1 | return $this->note; |
|
203 | } |
||
204 | |||
205 | /** |
||
206 | * @param string $nr |
||
207 | */ |
||
208 | 3 | public function setNr($nr) |
|
0 ignored issues
–
show
|
|||
209 | { |
||
210 | 3 | $this->nr = (string)$nr; |
|
211 | 3 | } |
|
212 | |||
213 | /** |
||
214 | * @return string |
||
215 | */ |
||
216 | 1 | public function getNr() |
|
217 | { |
||
218 | 1 | return $this->nr; |
|
219 | } |
||
220 | |||
221 | /** |
||
222 | * @param string $office |
||
223 | */ |
||
224 | 3 | public function setOffice($office) |
|
225 | { |
||
226 | 3 | $this->office = (string)$office; |
|
227 | 3 | } |
|
228 | |||
229 | /** |
||
230 | * @return string |
||
231 | */ |
||
232 | 1 | public function getOffice() |
|
233 | { |
||
234 | 1 | return $this->office; |
|
235 | } |
||
236 | |||
237 | /** |
||
238 | * @param Service $service |
||
239 | */ |
||
240 | 2 | public function addService(Service $service) |
|
241 | { |
||
242 | 2 | $this->services[] = $service; |
|
243 | 2 | } |
|
244 | |||
245 | /** |
||
246 | * @param Service[] $services |
||
247 | */ |
||
248 | public function setServices(array $services) |
||
249 | { |
||
250 | $this->services = $services; |
||
251 | } |
||
252 | |||
253 | /** |
||
254 | * @return Service[] |
||
255 | */ |
||
256 | public function getServices() |
||
257 | { |
||
258 | return $this->services; |
||
259 | } |
||
260 | |||
261 | /** |
||
262 | * @param string $street |
||
263 | */ |
||
264 | 3 | public function setStreet($street) |
|
265 | { |
||
266 | 3 | $this->street = (string)$street; |
|
267 | 3 | } |
|
268 | |||
269 | /** |
||
270 | * @return string |
||
271 | */ |
||
272 | 1 | public function getStreet() |
|
273 | { |
||
274 | 1 | return $this->street; |
|
275 | } |
||
276 | |||
277 | /** |
||
278 | * @param string $type |
||
279 | */ |
||
280 | 3 | public function setType($type) |
|
281 | { |
||
282 | 3 | $this->type = (string)$type; |
|
283 | 3 | } |
|
284 | |||
285 | /** |
||
286 | * @return string |
||
287 | */ |
||
288 | 2 | public function getType() |
|
289 | { |
||
290 | 2 | return $this->type; |
|
291 | } |
||
292 | |||
293 | /** |
||
294 | * @param int $x |
||
295 | */ |
||
296 | 3 | public function setX($x) |
|
0 ignored issues
–
show
|
|||
297 | { |
||
298 | 3 | $this->x = (int)$x; |
|
299 | 3 | } |
|
300 | |||
301 | /** |
||
302 | * @return int |
||
303 | */ |
||
304 | 1 | public function getX() |
|
305 | { |
||
306 | 1 | return $this->x; |
|
307 | } |
||
308 | |||
309 | /** |
||
310 | * @param int $y |
||
311 | */ |
||
312 | 3 | public function setY($y) |
|
0 ignored issues
–
show
|
|||
313 | { |
||
314 | 3 | $this->y = (int)$y; |
|
315 | 3 | } |
|
316 | |||
317 | /** |
||
318 | * @return int |
||
319 | */ |
||
320 | 1 | public function getY() |
|
321 | { |
||
322 | 1 | return $this->y; |
|
323 | } |
||
324 | |||
325 | /** |
||
326 | * @param string $zip |
||
327 | */ |
||
328 | 3 | public function setZip($zip) |
|
329 | { |
||
330 | 3 | $this->zip = (string)$zip; |
|
331 | 3 | } |
|
332 | |||
333 | /** |
||
334 | * @return string |
||
335 | */ |
||
336 | 1 | public function getZip() |
|
337 | { |
||
338 | 1 | return $this->zip; |
|
339 | } |
||
340 | |||
341 | /** |
||
342 | * @return string |
||
343 | */ |
||
344 | 1 | public function getPage() |
|
345 | { |
||
346 | 1 | return $this->page; |
|
347 | } |
||
348 | |||
349 | /** |
||
350 | * @param string $page |
||
351 | */ |
||
352 | 2 | public function setPage($page) |
|
353 | { |
||
354 | 2 | $this->page = (string)$page; |
|
355 | 2 | } |
|
356 | |||
357 | |||
358 | /** |
||
359 | * Create a POI based on an XML-object |
||
360 | * |
||
361 | * @param \SimpleXMLElement $xml |
||
362 | * @return Poi |
||
363 | * @throws BpostInvalidXmlResponseException |
||
364 | */ |
||
365 | 3 | public static function createFromXML(\SimpleXMLElement $xml) |
|
366 | { |
||
367 | 3 | if (!isset($xml->Record)) { |
|
368 | throw new BpostInvalidXmlResponseException('"Record" missing'); |
||
369 | } |
||
370 | |||
371 | 3 | $recordXml = $xml->Record; |
|
0 ignored issues
–
show
The property
Record does not seem to exist in SimpleXMLElement .
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
372 | |||
373 | 3 | $poi = new Poi(); |
|
374 | |||
375 | 3 | if (isset($recordXml->Id) && $recordXml->Id != '') { |
|
376 | 1 | $poi->setId((string)$recordXml->Id); |
|
377 | 1 | } |
|
378 | 3 | if (isset($recordXml->ID) && $recordXml->ID != '') { |
|
379 | 2 | $poi->setId((string)$recordXml->ID); |
|
380 | 2 | } |
|
381 | 3 | if (isset($recordXml->Type) && $recordXml->Type != '') { |
|
382 | 3 | $poi->setType((string)$recordXml->Type); |
|
383 | 3 | } |
|
384 | 3 | if (isset($recordXml->Name) && $recordXml->Name != '') { |
|
385 | 1 | $poi->setOffice((string)$recordXml->Name); |
|
386 | 1 | } |
|
387 | 3 | if (isset($recordXml->OFFICE) && $recordXml->OFFICE != '') { |
|
388 | 2 | $poi->setOffice((string)$recordXml->OFFICE); |
|
389 | 2 | } |
|
390 | 3 | if (isset($recordXml->Street) && $recordXml->Street != '') { |
|
391 | 1 | $poi->setStreet((string)$recordXml->Street); |
|
392 | 1 | } |
|
393 | 3 | if (isset($recordXml->STREET) && $recordXml->STREET != '') { |
|
394 | 2 | $poi->setStreet((string)$recordXml->STREET); |
|
395 | 2 | } |
|
396 | 3 | if (isset($recordXml->Number) && $recordXml->Number != '') { |
|
397 | 1 | $poi->setNr((string)$recordXml->Number); |
|
398 | 1 | } |
|
399 | 3 | if (isset($recordXml->NR) && $recordXml->NR != '') { |
|
400 | 2 | $poi->setNr((string)$recordXml->NR); |
|
401 | 2 | } |
|
402 | 3 | if (isset($recordXml->Zip) && $recordXml->Zip != '') { |
|
403 | 1 | $poi->setZip((string)$recordXml->Zip); |
|
404 | 1 | } |
|
405 | 3 | if (isset($recordXml->ZIP) && $recordXml->ZIP != '') { |
|
406 | 2 | $poi->setZip((string)$recordXml->ZIP); |
|
407 | 2 | } |
|
408 | 3 | if (isset($recordXml->City) && $recordXml->City != '') { |
|
409 | 1 | $poi->setCity((string)$recordXml->City); |
|
410 | 1 | } |
|
411 | 3 | if (isset($recordXml->CITY) && $recordXml->CITY != '') { |
|
412 | 2 | $poi->setCity((string)$recordXml->CITY); |
|
413 | 2 | } |
|
414 | 3 | if (isset($recordXml->X) && $recordXml->X != '') { |
|
415 | 3 | $poi->setX((int)$recordXml->X); |
|
416 | 3 | } |
|
417 | 3 | if (isset($recordXml->Y) && $recordXml->Y != '') { |
|
418 | 3 | $poi->setY((int)$recordXml->Y); |
|
419 | 3 | } |
|
420 | 3 | if (isset($recordXml->Longitude) && $recordXml->Longitude != '') { |
|
421 | 3 | $poi->setLongitude((float)$recordXml->Longitude); |
|
422 | 3 | } |
|
423 | 3 | if (isset($recordXml->Latitude) && $recordXml->Latitude != '') { |
|
424 | 3 | $poi->setLatitude((float)$recordXml->Latitude); |
|
425 | 3 | } |
|
426 | 3 | if (isset($recordXml->Services) && isset($recordXml->Services->Service)) { |
|
427 | 2 | foreach ($recordXml->Services->Service as $service) { |
|
428 | 2 | $poi->addService(Service::createFromXML($service)); |
|
429 | 2 | } |
|
430 | 2 | } |
|
431 | |||
432 | 3 | if (isset($recordXml->Hours)) { |
|
433 | 2 | $recordHoursXml = $recordXml->Hours; |
|
434 | |||
435 | 2 | if (isset($recordHoursXml->Monday)) { |
|
436 | 2 | $poi->addHour(Day::DAY_INDEX_MONDAY, Day::createFromXML($recordHoursXml->Monday)); |
|
437 | 2 | } |
|
438 | 2 | if (isset($recordHoursXml->Tuesday)) { |
|
439 | 2 | $poi->addHour(Day::DAY_INDEX_TUESDAY, Day::createFromXML($recordHoursXml->Tuesday)); |
|
440 | 2 | } |
|
441 | 2 | if (isset($recordHoursXml->Wednesday)) { |
|
442 | 2 | $poi->addHour(Day::DAY_INDEX_WEDNESDAY, Day::createFromXML($recordHoursXml->Wednesday)); |
|
443 | 2 | } |
|
444 | 2 | if (isset($recordHoursXml->Thursday)) { |
|
445 | 2 | $poi->addHour(Day::DAY_INDEX_THURSDAY, Day::createFromXML($recordHoursXml->Thursday)); |
|
446 | 2 | } |
|
447 | 2 | if (isset($recordHoursXml->Friday)) { |
|
448 | 2 | $poi->addHour(Day::DAY_INDEX_FRIDAY, Day::createFromXML($recordHoursXml->Friday)); |
|
449 | 2 | } |
|
450 | 2 | if (isset($recordHoursXml->Saturday)) { |
|
451 | 2 | $poi->addHour(Day::DAY_INDEX_SATURDAY, Day::createFromXML($recordHoursXml->Saturday)); |
|
452 | 2 | } |
|
453 | 2 | if (isset($recordHoursXml->Sunday)) { |
|
454 | 2 | $poi->addHour(Day::DAY_INDEX_SUNDAY, Day::createFromXML($recordHoursXml->Sunday)); |
|
455 | 2 | } |
|
456 | 2 | } |
|
457 | |||
458 | 3 | if (isset($recordXml->ClosedFrom) && $recordXml->ClosedFrom != '') { |
|
459 | $poi->setClosedFrom((string)$recordXml->ClosedFrom); |
||
0 ignored issues
–
show
(string) $recordXml->ClosedFrom is of type string , but the function expects a array .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
460 | } |
||
461 | 3 | if (isset($recordXml->ClosedTo) && $recordXml->ClosedTo != '') { |
|
462 | $poi->setClosedTo((string)$recordXml->ClosedTo); |
||
0 ignored issues
–
show
(string) $recordXml->ClosedTo is of type string , but the function expects a array .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
463 | } |
||
464 | 3 | if (isset($recordXml->NOTE) && $recordXml->NOTE != '') { |
|
465 | $poi->setNote((string)$recordXml->NOTE); |
||
466 | } |
||
467 | |||
468 | 3 | if (isset($xml->Page) && isset($xml->Page['ServiceRef']) && $xml->Page['ServiceRef'] != '') { |
|
469 | 2 | $poi->setPage($xml->Page['ServiceRef']); |
|
470 | 2 | } |
|
471 | |||
472 | 3 | return $poi; |
|
473 | } |
||
474 | } |
||
475 |
Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.