PHP Class Horde_Service_Weather_Base, horde

Author: Michael J Rubinsky ([email protected])
Exibir arquivo Open project: horde/horde Class Usage Examples

Public Properties

Property Type Description
$iconMap array Driver spcific icon map for condition icons. Made public so icons can be overridden in client code if desired.
$link string URL to the provider's site
$logo string URL to a logo for this provider
$title string Title for the provider
$units integer Units to display results in.

Protected Properties

Property Type Description
$_alerts
$_cache Horde_Cache Cache object
$_cache_lifetime integer Lifetime for cached data.
$_current Local cache of current conditions
$_forecast Horde_Service_Weather_Forecast_Base Local cache of forecast
$_http Horde_Http_Client The http client
$_lastLength integer Last requested forecast length.
$_lastLocation string Last location requested.
$_params array Parameters
$_radar
$_station Horde_Service_Weather_Station Local cache of station data

Public Methods

Method Description
__construct ( array $params = [] ) Constructor.
autocompleteLocation ( string $search ) : array Searches for locations that begin with the text in $search.
getAlerts ( $location ) : array Return array of weather alerts, if available.
getCurrentConditions ( string $location ) : Horde_Service_Weather_Current_Base Returns the current observations.
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.
getRadarImageUrl ( string $location ) : string | boolean Return the URL to a (possibly animated) radar image.
getStation ( ) : Horde_Service_Weather_Station Returns the station information associated with the last request.
getSupportedForecastLengths ( ) : array Get array of supported forecast lengths.
getTileServerUrl ( string $location, string $type = null ) : string | boolean Return the URL a OpenLayers suitable tile server.
getUnits ( integer $type = null ) : array Returns a mapping of units for each UNIT type.
searchLocations ( string $location, integer $type = Horde_Service_Weather::SEARCHTYPE_STANDARD ) : Horde_Service_Weather_Station Searches locations.

Protected Methods

Method Description
_ipIsUnique ( string $ip ) : boolean Check if an IP address is a globally unique address and not in RFC1918 or RFC3330 address space.

Method Details

__construct() public method

Constructor.
public __construct ( array $params = [] )
$params array 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.

_ipIsUnique() protected method

Check if an IP address is a globally unique address and not in RFC1918 or RFC3330 address space.
protected _ipIsUnique ( string $ip ) : boolean
$ip string The IPv4 IP address to check.
return boolean True if the IP address is globally unique, otherwise false.

autocompleteLocation() public method

Searches for locations that begin with the text in $search.
public autocompleteLocation ( string $search ) : array
$search string The text to search.
return array An array of stdClass objects with 'name' and 'code' properties.

getAlerts() public method

Return array of weather alerts, if available.
public getAlerts ( $location ) : array
return array

getCurrentConditions() abstract public method

Returns the current observations.
abstract public getCurrentConditions ( string $location ) : Horde_Service_Weather_Current_Base
$location string The location string.
return Horde_Service_Weather_Current_Base

getForecast() abstract public method

Returns the forecast for the current location.
abstract public getForecast ( string $location, integer $length = Horde_Service_Weather::FORECAST_3DAY, integer $type = Horde_Service_Weather::FORECAST_TYPE_STANDARD ) : Horde_Service_Weather_Forecast_Base
$location string The location code.
$length integer The forecast length, a Horde_Service_Weather::FORECAST_* constant.
$type integer The type of forecast to return, a Horde_Service_Weather::FORECAST_TYPE_* constant
return Horde_Service_Weather_Forecast_Base

getRadarImageUrl() public method

Return the URL to a (possibly animated) radar image.
public getRadarImageUrl ( string $location ) : string | boolean
$location string The location
return string | boolean The Url, or false if not available.

getStation() public method

Returns the station information associated with the last request.
public getStation ( ) : Horde_Service_Weather_Station
return Horde_Service_Weather_Station

getSupportedForecastLengths() abstract public method

Get array of supported forecast lengths.
abstract public getSupportedForecastLengths ( ) : array
return array The array of supported lengths.

getTileServerUrl() public method

Return the URL a OpenLayers suitable tile server.
public getTileServerUrl ( string $location, string $type = null ) : string | boolean
$location string The location.
$type string The optional layer type.
return string | boolean The Url, or false if not available.

getUnits() public method

Returns a mapping of units for each UNIT type.
public getUnits ( integer $type = null ) : array
$type integer The units for measurement. A Horde_Service_Weather::UNITS_* constant.
return array The mapping of measurements (as keys) and units (as values).

searchLocations() abstract public method

Searches locations.
abstract public searchLocations ( string $location, integer $type = Horde_Service_Weather::SEARCHTYPE_STANDARD ) : Horde_Service_Weather_Station
$location string The location string to search.
$type integer The type of search to perform, a Horde_Service_Weather::SEARCHTYPE_* constant.
return Horde_Service_Weather_Station The search location suitable to use directly in a weather request.

Property Details

$_alerts protected_oe property

protected $_alerts

$_cache protected_oe property

Cache object
protected Horde_Cache $_cache
return Horde_Cache

$_cache_lifetime protected_oe property

Lifetime for cached data.
protected int $_cache_lifetime
return integer

$_current protected_oe property

Local cache of current conditions
protected $_current

$_forecast protected_oe property

Local cache of forecast
protected Horde_Service_Weather_Forecast_Base $_forecast
return Horde_Service_Weather_Forecast_Base

$_http protected_oe property

The http client
protected Horde_Http_Client $_http
return Horde_Http_Client

$_lastLength protected_oe property

Last requested forecast length.
protected int $_lastLength
return integer

$_lastLocation protected_oe property

Last location requested.
protected string $_lastLocation
return string

$_params protected_oe property

Parameters
protected array $_params
return array

$_radar protected_oe property

protected $_radar

$_station protected_oe property

Local cache of station data
protected Horde_Service_Weather_Station $_station
return Horde_Service_Weather_Station

$iconMap public_oe property

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

$title public_oe property

Title for the provider
public string $title
return string

$units public_oe property

Units to display results in.
public int $units
return integer