1: <?php
2: /**
3: * This file contains the Horde_Service_Weather_Current_Base class for
4: * abstracting access to current observations.
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_Current_Base class
16: *
17: * @property pressure The barometric pressure.
18: * @property pressure_trend The pressure trend.
19: * @property logo_url URL to a provider logo.
20: * @property dewpoint The dewpoint.
21: * @property wind_direction The cardinal wind direction.
22: * @property wind_degrees The wind direction, in degrees.
23: * @property wind_speed The wind speed, in requested units.
24: * @property wind_gust The wind gust speed.
25: * @property visibility The visisbility, in requested units.
26: * @property wind_chill The wind chill.
27: * @property heat_index Heat index.
28: * @property temp The temperature.
29: * @property icon Icon name to represent conditions.
30: * @property condition The condition string.
31: * @property humidity The humidity.
32: * @property wind Full wind description string.
33: * @property icon_url Url to icon.
34: * @property logo_url Url to logo.
35: * @property time Forecast time.
36: *
37: * @author Michael J Rubinsky <mrubinsk@horde.org>
38: * @category Horde
39: * @package Service_Weather
40: */
41: class Horde_Service_Weather_Current_Base
42: {
43: /**
44: * Local properties cache.
45: *
46: * @var array
47: */
48: protected $_properties = array();
49:
50: /**
51: * Parent weather object.
52: *
53: * @var Horde_Service_Weather_Base
54: */
55: protected $_weather;
56:
57: /**
58: * Const'r
59: *
60: * @param mixed $properties Current properties, in driver keys.
61: *
62: * @return Horde_Service_Weather_Current_Base
63: */
64: public function __construct($properties, Horde_Service_Weather_Base $weather)
65: {
66: $this->_properties = $properties;
67: $this->_weather = $weather;
68: }
69:
70: public function __get($property)
71: {
72: if (isset($this->_properties[$property])) {
73: return $this->_properties[$property];
74: }
75:
76: throw new Horde_Service_Weather_Exception_InvalidProperty('This station does not support that property');
77: }
78:
79: }