Constants

API_URL

API_URL

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

$_language

$_language : string

Language to request strings from Google in.

Type

string

Methods

__construct()

__construct(array  $params = array()) : \Horde_Service_Weather_WeatherUnderground

Constructor.

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.
  • apikey: (string) Require api key for Wwo.

Returns

\Horde_Service_Weather_WeatherUnderground

getCurrentConditions()

getCurrentConditions(string  $location) : \Horde_Service_Weather_Current_WeatherUnderground.

Obtain the current observations.

Parameters

string $location

The location string.

Returns

\Horde_Service_Weather_Current_WeatherUnderground.

getForecast()

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

Obtain the forecast for the current location.

Parameters

string $location

The location code.

integer $length

The forecast length, a Horde_ServiceWeather::FORECAST* constant.

integer $type

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

Returns

\Horde_Service_Weather_Forecast_WeatherUnderground

searchLocations()

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

Search for a valid location code.

Parameters

string $location

The location string to search.

integer $type

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

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

Return an autocomplete search response.

Parameters

string $search

The text to search.

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

_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.

_getLocationByIp()

_getLocationByIp(string  $ip) : string

Perform an IP location search.

Parameters

string $ip

The IP address to use.

Returns

string —

The location code.

_searchLocations()

_searchLocations(string  $location) : string

Execute a location search.

Parameters

string $location

The location text to search.

Returns

string —

The location code result(s).

_getCommonElements()

_getCommonElements(  $location,   $length = null) 

Weather Underground allows requesting multiple features per request, and only counts it as a single request against your API key. So we trade a bit of request time/traffic for a smaller number of requests to obtain information for e.g., a typical weather portal display.

Parameters

$location
$length

_parseStation()

_parseStation(\StdClass  $station) : \Horde_Service_Weather_Station

Parses the JSON response for a location request into a station object.

Parameters

\StdClass $station

The response from a Location request.

Returns

\Horde_Service_Weather_Station

_parseForecast()

_parseForecast(\stdClass  $forecast) : \Horde_Service_Weather_Forecast_WeatherUnderground

Parses the forecast data.

Parameters

\stdClass $forecast

The result of the forecast request.

Returns

\Horde_Service_Weather_Forecast_WeatherUnderground

The forecast.

_parseAstronomy()

_parseAstronomy(\{[type]}  $astronomy) : \{[type]}

Parses astronomy information. Returned as an array since this will be added to the station information.

Parameters

\{[type]} $astronomy

[description]

Returns

\{[type]}

_parseCurrent()

_parseCurrent(\stdClass  $current) : \Horde_Service_Weather_Current

Parse the current_conditions response.

Parameters

\stdClass $current

The current_condition request response object

Returns

\Horde_Service_Weather_Current

_parseSearchLocations()

_parseSearchLocations(  $response) 

Parameters

$response

_parseAutocomplete()

_parseAutocomplete(  $results) 

Parameters

$results

_parseAlerts()

_parseAlerts(  $alerts) 

Parameters

$alerts

_makeRequest()

_makeRequest(  $url,   $lifetime = 86400) 

Parameters

$url
$lifetime