Class Weather

Description

PolarLava::Weather - A class to retrieve XML weather from the NOAA NWS.

This class requires PHP >= 5.0.0

Located in /Weather_class.php (line 23)


	
			
Variable Summary
Method Summary
Weather __construct ([array $params = array()])
string getCacheDir ()
int getCacheTime ()
array getError ()
string getImageDir ()
string getObsStation ()
string getStationArray ()
array getStations (string $state)
string getUrl ()
string getWeatherArray ()
string getWeatherElement (string $a)
string getXml ()
NULL setCacheDir (string $a)
NULL setCacheTime (int $a)
NULL setCacheTimeSid (int $a)
NULL setError (boolean $err, [string $usr_msg = NULL], [string $dbg_msg = NULL])
NULL setImageDir (string $a)
NULL setObsStation (string $a)
NULL setUrl (string $a)
NULL setXml (string $a)
boolean _getWeatherXml ([string $station_id = NULL], [int $cache_time = -1])
NULL _setLocalImage ()
boolean _setStationArray ()
boolean _setStationCache ()
boolean _setWeatherArray ()
array __toArray ()
array __toString ()
Variables
string $_cache_dir (line 29)
  • var: Local XML data cache directory
  • access: protected
int $_cache_time (line 35)
  • var: Local XML data cache valid time in minutes
  • access: protected
int $_cache_time_sid (line 41)
  • var: Local XML station data cache valid time in minutes
  • access: protected
boolean $_error (line 47)
  • var: Error flag
  • access: protected
string $_error_msg_debug (line 59)
  • var: Error message for debugging
  • access: protected
string $_error_msg_user (line 53)
  • var: Error message for user
  • access: protected
string $_image_dir (line 65)
  • var: Local conditions image directory
  • access: protected
string $_obs_station (line 71)
  • var: The weather observation station
  • access: protected
array $_station_array (line 77)
  • var: weather station data array
  • access: private
string $_url (line 83)
  • var: The base weather service URL
  • access: protected
array $_weather_array (line 89)
  • var: weather data array
  • access: private
string $_xml (line 96)
Methods
Constructor __construct (line 117)

Weather object constructor

Accepts an array of configuration parameters as key/value pairs:

  • 'url' => 'Weather service XML url' default NOAA/NWS
  • 'obs_station' => 'observation station code' default 'KIAG'
  • 'image_dir' => 'local image directory' default NULL
  • 'cache_dir' => 'local cache directory' default NULL
  • 'cache_time' => 'local cache time in minutes' default 60 minutes
  • 'cache_time_sid' => 'local cache time in minutes' for station data. Default 10080 (7 days)
  • 'fetch_weather' => boolean flag, TRUE fetches weather data (default)
  • 'fetch_stations' => boolean flag, TRUE fetches available weather stations data
  • 'cache_stations' => boolean flag, TRUE serializes station data to cache

  • access: public
Weather __construct ([array $params = array()])
  • array $params
getCacheDir (line 392)

Get the local XML data cache directory.

  • access: public
string getCacheDir ()
getCacheTime (line 401)

Get the local cache valid time in minutes.

  • access: public
int getCacheTime ()
getCacheTimeSid (line 410)

Get the local station cache valid time in minutes.

  • access: public
int getCacheTimeSid ()
getError (line 419)

Get the error status and messages.

  • return: $this->_error_msg_user, $this->_error_msg_debug
  • access: public
array getError ()
getImageDir (line 430)

Get the local conditions image directory.

  • access: public
string getImageDir ()
getObsStation (line 439)

Get the weather observation station.

  • access: public
string getObsStation ()
getStationArray (line 466)

Get the weather station data array.

  • access: public
string getStationArray ()
getStations (line 476)

Get the weather stations from the station data array.

  • access: public
array getStations (string $state)
  • string $state: The location's stations.
getUrl (line 448)

Get the weather service URL.

  • access: public
string getUrl ()
getWeatherArray (line 457)

Get the weather data array.

  • access: public
string getWeatherArray ()
getWeatherElement (line 486)

Get a single element from the weather data array.

  • access: public
string getWeatherElement (string $a)
  • string $a
getWeatherElements (line 499)

Get an array of all available data points from the weather data array.

  • return: Array keys from $this->_weather_array.
  • access: public
array getWeatherElements ()
getXml (line 568)

Get the weather xml data.

  • access: public
string getXml ()
setCacheDir (line 163)

Set the local XML data cache directory.

  • access: public
NULL setCacheDir (string $a)
  • string $a
setCacheTime (line 173)

Set the local XML data cache valid time in minutes.

  • access: public
NULL setCacheTime (int $a)
  • int $a
setCacheTimeSid (line 183)

Set the local XML station data cache valid time in minutes.

  • access: public
NULL setCacheTimeSid (int $a)
  • int $a
setError (line 196)

Set the error flag and message.

  • access: protected
NULL setError (boolean $err, [string $usr_msg = NULL], [string $dbg_msg = NULL])
  • boolean $err
  • string $usr_msg: The user error message
  • string $dbg_msg: The debug error message
setImageDir (line 208)

Set the local conditions image directory.

  • access: public
NULL setImageDir (string $a)
  • string $a
setObsStation (line 243)

Set the weather observation station.

NULL setObsStation (string $a)
  • string $a
setUrl (line 253)

Set the weather data base URL.

  • access: public
NULL setUrl (string $a)
  • string $a
setXml (line 379)

Set the weather xml data.

  • access: protected
NULL setXml (string $a)
  • string $a
_getWeatherStationXml (line 559)

Retrieve XML weather station data

  • return: success status
  • access: protected
boolean _getWeatherStationXml ()
_getWeatherXml (line 515)

Retrieve XML weather data

  • return: success status
  • access: protected
boolean _getWeatherXml ([string $station_id = NULL], [int $cache_time = -1])
  • string $station_id: Optional station ID. Default is getObsStation().
  • int $cache_time: Optional cache_time override
_setLocalImage (line 218)

Checks and retrieves the local conditions image.

  • access: protected
NULL _setLocalImage ()
_setStationArray (line 309)

Convert XML weather station data to array

  • return: success status
  • access: protected
boolean _setStationArray ()
_setStationCache (line 360)

Serializes weather station data array and saves it to cache_dir

  • return: success status
  • access: protected
boolean _setStationCache ()
_setWeatherArray (line 263)

Convert XML weather data to array

  • return: success status
  • access: protected
boolean _setWeatherArray ()
__toArray (line 582)

Return an array dump of the (parsed XML) weather data

  • access: public
array __toArray ()
__toString (line 591)

Return a dump of the XML data

  • access: public
array __toString ()

Documentation generated on Sun, 18 Mar 2007 09:38:32 -0400 by phpDocumentor 1.3.1