3
* This file contains the Horde_Service_Weather_Current class for abstracting
4
* access to current observations from WorldWeatherOnline.
6
* Copyright 2011-2014 Horde LLC (http://www.horde.org/)
8
* @author Michael J Rubinsky <mrubinsk@horde.org>
9
* @license http://www.horde.org/licenses/bsd BSD
11
* @package Service_Weather
15
* Horde_Service_Weather_Current_Wwo class
17
* @author Michael J Rubinsky <mrubinsk@horde.org>
19
* @package Service_Weather
21
class Horde_Service_Weather_Current_Wwo extends Horde_Service_Weather_Current_Base
23
protected $_map = array(
24
'humidity' => 'humidity',
25
'wind_direction' => 'winddir16Point',
26
'wind_degrees' => 'winddirDegree'
29
public function __isset($property)
31
return !empty($this->_properties->$property);
34
public function __get($property)
36
// Maybe someday I can add a better $_map array with 'type' fields etc..
37
// for now, just as easy to manually check for these exceptions.
43
case 'pressure_trend':
48
return Horde_Service_Weather_Translation::t($this->_properties->weatherDesc[0]->value);
50
// Note that even though this is "localObsDateTime", the timezone set
51
// in the date object will be the server's default timezone since it's
52
// impossible to figure out the timezone from the information given by
55
return new Horde_Date($this->_properties->localObsDateTime);
58
return new Horde_Date($this->_properties->date . ' ' . $this->_properties->observation_time, 'UTC');
61
if ($this->_weather->units == Horde_Service_Weather::UNITS_STANDARD) {
62
return $this->_properties->temp_F;
64
return $this->_properties->temp_C;
67
if ($this->_weather->units == Horde_Service_Weather::UNITS_STANDARD) {
68
return $this->_properties->windspeedMiles;
70
return $this->_properties->windspeedKmph;
73
if ($this->_weather->units == Horde_Service_Weather::UNITS_METRIC) {
74
return $this->_properties->visibility;
76
return round($this->_properties->visibility * Horde_Service_Weather::CONVERSION_KPH_TO_MPH);
80
if ($this->_weather->units == Horde_Service_Weather::UNITS_STANDARD) {
81
return round($this->_properties->pressure * Horde_Service_Weather::CONVERSION_MB_TO_INCHES, 2);
83
return $this->_properties->pressure;
86
return $this->_weather->iconMap[
87
str_replace('.png', '', basename($this->_properties->weatherIconUrl[0]->value))
91
return $this->_properties->humidity . '%';
93
if (empty($this->_map[$property])) {
94
throw new Horde_Service_Weather_Exception_InvalidProperty();
96
return Horde_Service_Weather_Translation::t($this->_properties->{$this->_map[$property]});
b'\\ No newline at end of file'