/** * @param \SimpleXMLElement $xml * @return Forecast[] */ public static function getForecastsFromXml(\SimpleXMLElement $xml) { $forecasts = array(); foreach ($xml->forecast->tabular->time as $forecast) { try { $forecasts[] = Forecast::getForecastFromXml($forecast); } catch (\RuntimeException $e) { // Skip those we cant create.. } } return $forecasts; }