|
@@ 202-206 (lines=5) @@
|
| 199 |
|
// Invalid xml format. This happens in case OpenWeatherMap returns an error. |
| 200 |
|
// OpenWeatherMap always uses json for errors, even if one specifies xml as format. |
| 201 |
|
$error = json_decode($answer, true); |
| 202 |
|
if (isset($error['message'])) { |
| 203 |
|
throw new OWMException($error['message'], $error['cod']); |
| 204 |
|
} else { |
| 205 |
|
throw new OWMException('Unknown fatal error: OpenWeatherMap returned the following json object: ' . $answer); |
| 206 |
|
} |
| 207 |
|
} |
| 208 |
|
|
| 209 |
|
return new CurrentWeather($xml, $units); |
|
@@ 272-276 (lines=5) @@
|
| 269 |
|
// Invalid xml format. This happens in case OpenWeatherMap returns an error. |
| 270 |
|
// OpenWeatherMap always uses json for errors, even if one specifies xml as format. |
| 271 |
|
$error = json_decode($answer, true); |
| 272 |
|
if (isset($error['message'])) { |
| 273 |
|
throw new OWMException($error['message'], $error['cod']); |
| 274 |
|
} else { |
| 275 |
|
throw new OWMException('Unknown fatal error: OpenWeatherMap returned the following json object: ' . $answer); |
| 276 |
|
} |
| 277 |
|
} |
| 278 |
|
|
| 279 |
|
return new WeatherForecast($xml, $units, $days); |