@@ -213,6 +213,34 @@ public function getWeatherForecast($query, $units = 'imperial', $lang = 'en', $a
213213 return new WeatherForecast ($ xml , $ units , $ days );
214214 }
215215
216+ /**
217+ * Returns the DAILY forecast for the place you specified. DANGER: Might return
218+ * fewer results than requested due to a bug in the OpenWeatherMap API!
219+ *
220+ * @param array|int|string $query The place to get weather information for. For possible values see ::getWeather.
221+ * @param string $units Can be either 'metric' or 'imperial' (default). This affects almost all units returned.
222+ * @param string $lang The language to use for descriptions, default is 'en'. For possible values see http://openweathermap.org/current#multi.
223+ * @param string $appid Your app id, default ''. See http://openweathermap.org/appid for more details.
224+ * @param int $days For how much days you want to get a forecast. Default 1, maximum: 16.
225+ *
226+ * @throws OpenWeatherMap\Exception If OpenWeatherMap returns an error.
227+ * @throws \InvalidArgumentException If an argument error occurs.
228+ *
229+ * @return WeatherForecast
230+ *
231+ * @api
232+ */
233+ public function getDailyWeatherForecast ($ query , $ units = 'imperial ' , $ lang = 'en ' , $ appid = '' , $ days = 1 )
234+ {
235+ if ($ days > 16 ) {
236+ throw new \InvalidArgumentException ('Error: forecasts are only available for the next 16 days. $days must be 16 or lower. ' );
237+ }
238+
239+ $ answer = $ this ->getRawDailyForecastData ($ query , $ units , $ lang , $ appid , 'xml ' , $ days );
240+ $ xml = $ this ->parseXML ($ answer );
241+ return new WeatherForecast ($ xml , $ units , $ days );
242+ }
243+
216244 /**
217245 * Returns the weather history for the place you specified.
218246 *
0 commit comments