PHP 클래스 Horde_Service_Weather_Metar, horde

Responsible for parsing encoded METAR and TAF data.
저자: Michael J Rubinsky ([email protected])
상속: extends Horde_Service_Weather_Base
파일 보기 프로젝트 열기: horde/horde 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_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