1: <?php
2: /**
3: * This file contains the Horde_Service_Weather_Forecast class for abstracting
4: * access to forecast data from WorldWideWeather
5: *
6: * Copyright 2011-2012 Horde LLC (http://www.horde.org/)
7: *
8: * @author Michael J Rubinsky <mrubinsk@horde.org>
9: * @license http://www.horde.org/licenses/bsd BSD
10: * @category Horde
11: * @package Service_Weather
12: */
13:
14: /**
15: * Horde_Service_Weather_Forecast_Wwo
16: *
17: * @author Michael J Rubinsky <mrubinsk@horde.org>
18: * @category Horde
19: * @package Service_Weather
20: */
21: class Horde_Service_Weather_Forecast_Wwo extends Horde_Service_Weather_Forecast_Base
22: {
23:
24: public $fields = array(
25: Horde_Service_Weather::FORECAST_FIELD_WIND);
26:
27: public function __construct(
28: $properties,
29: Horde_Service_Weather_Base $weather,
30: $type = Horde_Service_Weather::FORECAST_TYPE_STANDARD)
31: {
32: parent::__construct($properties, $weather, $type);
33: $this->_parseStd();
34: }
35:
36: public function getForecastTime()
37: {
38: return new Horde_Date($this->weather->getStation()->time);
39: }
40:
41: /**
42: * Parse a stdRequest
43: *
44: * @throws Horde_Service_Weather_Exception
45: */
46: protected function _parseStd()
47: {
48: if (empty($this->_properties)) {
49: throw new Horde_Service_Weather_Exception('No forecast data to parse.');
50: }
51:
52: foreach ($this->_properties as $period => $values) {
53: $period = new Horde_Service_Weather_Period_Wwo($values, $this);
54: $this->_periods[] = $period;
55: }
56: }
57:
58: }