Cmfcmf\OpenWeatherMap::getDailyWeatherForecast PHP Method

getDailyWeatherForecast() public method

Returns the DAILY forecast for the place you specified. DANGER: Might return fewer results than requested due to a bug in the OpenWeatherMap API!
public getDailyWeatherForecast ( array | integer | string $query, string $units = 'imperial', string $lang = 'en', string $appid = '', integer $days = 1 ) : WeatherForecast
$query array | integer | string The place to get weather information for. For possible values see ::getWeather.
$units string Can be either 'metric' or 'imperial' (default). This affects almost all units returned.
$lang string The language to use for descriptions, default is 'en'. For possible values see http://openweathermap.org/current#multi.
$appid string Your app id, default ''. See http://openweathermap.org/appid for more details.
$days integer For how much days you want to get a forecast. Default 1, maximum: 16.
return Cmfcmf\OpenWeatherMap\WeatherForecast
    public function getDailyWeatherForecast($query, $units = 'imperial', $lang = 'en', $appid = '', $days = 1)
    {
        if ($days > 16) {
            throw new \InvalidArgumentException('Error: forecasts are only available for the next 16 days. $days must be 16 or lower.');
        }
        $answer = $this->getRawDailyForecastData($query, $units, $lang, $appid, 'xml', $days);
        $xml = $this->parseXML($answer);
        return new WeatherForecast($xml, $units, $days);
    }