Properties

$units

$units : integer

Units to display results in.

Type

integer

$logo

$logo : string

URL to a logo for this provider

Type

string

$link

$link : string

URL to the provider's site

Type

string

$title

$title : string

Title for the provider

Type

string

$iconMap

$iconMap : array

Driver spcific icon map for condition icons. Made public so icons can be overridden in client code if desired.

Type

array

$_params

$_params : array

Parameters

Type

array

$_cache

$_cache : \Horde_Cache

Cache object

Type

\Horde_Cache

$_cache_lifetime

$_cache_lifetime : integer

Lifetime for cached data.

Type

integer

$_http

$_http : \Horde_Http_Client

The http client

Type

\Horde_Http_Client

$_current

$_current : 

Local cache of current conditions

Type

$_lastLocation

$_lastLocation : string

Last location requested.

Type

string

$_lastLength

$_lastLength : integer

Last requested forecast length.

Type

integer

$_alerts

$_alerts : 

Type

$_radar

$_radar : 

Type

$_db

$_db : \Horde_Db_Adapter_Base

Database handle. Expects to have the following table available:

Type

\Horde_Db_Adapter_Base

$_tableName

$_tableName : string

Name of table containing the NOAA METAR database.

Type

string

$_metar_path

$_metar_path : string

Default paths to download weather data.

Type

string

$_taf_path

$_taf_path : 

Type

$_locations

$_locations : array

Local cache of locations.

Type

array

Methods

__construct()

__construct(array  $params = array()) 

Constructor.

In addtion to the params for the parent class, you can also set a database adapter for NOAA station lookups, and if you don't want to use the default METAR/TAF http locations, you can set them here too. Note only HTTP is currently supported, but file and ftp are @todo.

Parameters

array $params

Parameters:

  • cache: (Horde_Cache) Optional Horde_Cache object.
  • cache_lifetime: (integer) Lifetime of cached data, if caching.
  • http_client: (Horde_Http_Client) Required http client object.
  • db: (Horde_Db_Adapter_Base) DB Adapter for METAR DB.
  • metar_path: (string) Path or URL to METAR data.
  • taf_path: (string) Path or URL to TAF data.

getCurrentConditions()

getCurrentConditions(string  $location) : \Horde_Service_Weather_Current_Base

Returns the current observations (METAR).

Parameters

string $location

The location string.

Throws

\Horde_Service_Weather_Exception

Returns

\Horde_Service_Weather_Current_Base

getForecast()

getForecast(string  $location, integer  $length = \Horde_Service_Weather::FORECAST_3DAY, integer  $type = \Horde_Service_Weather::FORECAST_TYPE_STANDARD) : \Horde_Service_Weather_Forecast_Base

Returns the forecast for the current location.

Parameters

string $location

The location code.

integer $length

The forecast length, a Horde_ServiceWeather::FORECAST* constant. (Ignored)

integer $type

The type of forecast to return, a Horde_Service_Weather::FORECASTTYPE* constant (Ignored)

Throws

\Horde_Service_Weather_Exception

Returns

\Horde_Service_Weather_Forecast_Base

searchLocations()

searchLocations(string  $location, integer  $type = \Horde_Service_Weather::SEARCHTYPE_STANDARD) : \Horde_Service_Weather_Station

Searches locations.

Parameters

string $location

The location string to search.

integer $type

The type of search to perform, a Horde_ServiceWeather::SEARCHTYPE* constant.

Throws

\Horde_Service_Weather_Exception

Returns

\Horde_Service_Weather_Station

The search location suitable to use directly in a weather request.

getSupportedForecastLengths()

getSupportedForecastLengths() : array

Get array of supported forecast lengths.

Returns

array —

The array of supported lengths.

getAlerts()

getAlerts(  $location) : array

Return array of weather alerts, if available.

Parameters

$location

Returns

array

getRadarImageUrl()

getRadarImageUrl(string  $location) : string|boolean

Return the URL to a (possibly animated) radar image.

Parameters

string $location

The location

Returns

string|boolean —

The Url, or false if not available.

getTileServerUrl()

getTileServerUrl(string  $location, string  $type = null) : string|boolean

Return the URL a OpenLayers suitable tile server.

Parameters

string $location

The location.

string $type

The optional layer type.

Returns

string|boolean —

The Url, or false if not available.

autocompleteLocation()

autocompleteLocation(string  $search) : array

Searches for locations that begin with the text in $search.

Parameters

string $search

The text to search.

Throws

\Horde_Service_Weather_Exception

Returns

array —

An array of stdClass objects with 'name' and 'code' properties.

getUnits()

getUnits(integer  $type = null) : array

Returns a mapping of units for each UNIT type.

Parameters

integer $type

The units for measurement. A Horde_ServiceWeather::UNITS* constant.

Returns

array —

The mapping of measurements (as keys) and units (as values).

getStation()

getStation() : \Horde_Service_Weather_Station

Returns the station information associated with the last request.

Throws

\Horde_Service_Weather_Exception

if not request has yet been made.

Returns

\Horde_Service_Weather_Station

getLocations()

getLocations() : array

Return an array containing all available METAR locations/airports.

Returns

array —

An array of station information. Each entry contains:

  • icao: The ICAO identifier of the location.
  • name: The human readable name of the station.
  • country: The country the station is located in (if available).

_ipIsUnique()

_ipIsUnique(string  $ip) : boolean

Check if an IP address is a globally unique address and not in RFC1918 or RFC3330 address space.

Parameters

string $ip

The IPv4 IP address to check.

Returns

boolean —

True if the IP address is globally unique, otherwise false.

_makeRequest()

_makeRequest(string  $url, integer  $lifetime = 86400) : string

Performs a HTTP request.

Parameters

string $url

The URL endpoint.

integer $lifetime

The cache lifetime.

Throws

\Horde_Service_Weather_Exception

Returns

string —

The response body of the request.

_getLocations()

_getLocations() : array

Perform DB query to obtain list of airport codes.

Throws

\Horde_Service_Weather_Exception

Returns

array —

An array of station information. Each entry contains:

  • icao: The ICAO identifier of the location.
  • name: The human readable name of the station.
  • country: The country the station is located in (if available).

_getStation()

_getStation(string  $code) : \Horde_Service_Weather_Station

Return a station object matching $code.

Parameters

string $code

The ICAO station identifier.

Throws

\Horde_Service_Weather_Exception
\Horde_Exception_NotFound

Returns

\Horde_Service_Weather_Station

The station object.