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. |
/** * Constructor. * * @param 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. * * @return Horde_Service_Weather_Wwo */ public function __construct(array $params = array()) { // Check required api key parameters here... if (empty($params['apikey'])) { throw new InvalidArgumentException('Missing required API Key parameter.'); } $this->_key = $params['apikey']; unset($params['apikey']); parent::__construct($params); }
/** * Constructor. * * 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. * * @param 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. * - 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. */ public function __construct(array $params = array()) { // Mini-hack to avoid passing a http_client object if // we really don't need it. if (empty($params['http_client']) && !empty($params['metar_path']) && !empty($params['taf_path'])) { $params['http_client'] = true; } parent::__construct($params); if (!empty($params['db'])) { $this->_db = $params['db']; } if (!empty($params['metar_path'])) { $this->_metar_path = $params['metar_path']; } if (!empty($params['taf_path'])) { $this->_taf_path = $params['taf_path']; } if (!empty($params['table_name'])) { $this->_tableName = $params['table_name']; } }