PHP Класс Horde_Service_Weather_Metar, horde

Responsible for parsing encoded METAR and TAF data.
Автор: Michael J Rubinsky ([email protected])
Наследование: extends Horde_Service_Weather_Base
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_db Horde_Db_Adapter_Base Database handle. Expects to have the following table available:
$_locations array Local cache of locations.
$_metar_path string Default paths to download weather data.
$_tableName string Name of table containing the NOAA METAR database.
$_taf_path

Открытые методы

Метод Описание
__construct ( array $params = [] ) Constructor.
autocompleteLocation ( string $search ) : array Searches for locations that begin with the text in $search.
getCurrentConditions ( string $location ) : Horde_Service_Weather_Current_Base Returns the current observations (METAR).
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.
getLocations ( ) : array Return an array containing all available METAR locations/airports.
getSupportedForecastLengths ( ) : array Get array of supported forecast lengths.
searchLocations ( string $location, integer $type = Horde_Service_Weather::SEARCHTYPE_STANDARD ) : Horde_Service_Weather_Station Searches locations.

Защищенные методы

Метод Описание
_getLocations ( ) : array Perform DB query to obtain list of airport codes.
_getStation ( string $code ) : Horde_Service_Weather_Station Return a station object matching $code.
_makeRequest ( string $url, integer $lifetime = 86400 ) : string Performs a HTTP request.

Описание методов

__construct() публичный Метод

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

_getLocations() защищенный Метод

Perform DB query to obtain list of airport codes.
protected _getLocations ( ) : array
Результат 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() защищенный Метод

Return a station object matching $code.
protected _getStation ( string $code ) : Horde_Service_Weather_Station
$code string The ICAO station identifier.
Результат Horde_Service_Weather_Station The station object.

_makeRequest() защищенный Метод

Performs a HTTP request.
protected _makeRequest ( string $url, integer $lifetime = 86400 ) : string
$url string The URL endpoint.
$lifetime integer The cache lifetime.
Результат string The response body of the request.

autocompleteLocation() публичный Метод

Searches for locations that begin with the text in $search.
public autocompleteLocation ( string $search ) : array
$search string The text to search.
Результат array An array of stdClass objects with 'name' and 'code' properties.

getCurrentConditions() публичный Метод

Returns the current observations (METAR).
public getCurrentConditions ( string $location ) : Horde_Service_Weather_Current_Base
$location string The location string.
Результат Horde_Service_Weather_Current_Base

getForecast() публичный Метод

Returns the forecast for the current location.
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. (Ignored)
$type integer The type of forecast to return, a Horde_Service_Weather::FORECAST_TYPE_* constant (Ignored)
Результат Horde_Service_Weather_Forecast_Base

getLocations() публичный Метод

Return an array containing all available METAR locations/airports.
public getLocations ( ) : array
Результат 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).

getSupportedForecastLengths() публичный Метод

Get array of supported forecast lengths.
public getSupportedForecastLengths ( ) : array
Результат array The array of supported lengths.

searchLocations() публичный Метод

Searches locations.
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.
Результат Horde_Service_Weather_Station The search location suitable to use directly in a weather request.

Описание свойств

$_db защищенное свойство

Database handle. Expects to have the following table available:
protected Horde_Db_Adapter_Base $_db
Результат Horde_Db_Adapter_Base

$_locations защищенное свойство

Local cache of locations.
protected array $_locations
Результат array

$_metar_path защищенное свойство

Default paths to download weather data.
protected string $_metar_path
Результат string

$_tableName защищенное свойство

Name of table containing the NOAA METAR database.
protected string $_tableName
Результат string

$_taf_path защищенное свойство

protected $_taf_path