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

$_key

$_key : string

Owm API key.

Type

string

$_locationCode

$_locationCode : 

Type

Methods

__construct()

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

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.
  • apiVersion: (integer) Version of the API to use. Defaults to v1 for BC reasons.

Returns

\Horde_Service_Weather_Wwo

getCurrentConditions()

getCurrentConditions(string  $location) : \Horde_Service_Weather_Current_Wwo

Obtain the current observations.

Parameters

string $location

The location string.

Returns

\Horde_Service_Weather_Current_Wwo

getForecast()

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

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_Base

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

Return the 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 request result.

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.

_getCommonElements()

_getCommonElements(string  $location, integer  $length = \Horde_Service_Weather::FORECAST_5DAY) 

Populates some common data used by forecasts and current conditions.

Parameters

string $location

The location identifier.

integer $length

The forecast 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_Wwo

Parses the forecast data.

Parameters

\stdClass $forecast

The result of the forecast request.

Returns

\Horde_Service_Weather_Forecast_Wwo

The forecast.

_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

_parseAutocomplete()

_parseAutocomplete(array  $results) : \[type]

Parameters

array $results

An array of Horde_Service_Weather_Station objects.

Returns

\[type] —

[description]

_searchLocations()

_searchLocations(string  $location) : string

Execute a location search.

Parameters

string $location

The location text to search.

Returns

string —

The location code result(s).

_parseSearchLocations()

_parseSearchLocations(\stdClass  $response) : array

Return an array of location search results.

Parameters

\stdClass $response

The results of a find query.

Throws

\Horde_Service_Weather_Exception

Returns

array —

An array of Horde_Service_Weather_Station objects.

_makeRequest()

_makeRequest(\Horde_Url  $url) : mixed

Make the remote API call.

Parameters

\Horde_Url $url

The endpoint.

Throws

\Horde_Service_Weather_Exception

Returns

mixed —

The unserialized results form the remote API call.