Horde_Service_Weather_Base::__construct PHP Method

__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.
    public function __construct(array $params = array())
    {
        if (empty($params['http_client'])) {
            throw new InvalidArgumentException('Missing http_client parameter.');
        }
        $this->_http = $params['http_client'];
        unset($params['http_client']);
        if (!empty($params['cache'])) {
            $this->_cache = $params['cache'];
            unset($params['cache']);
            if (!empty($params['cache_lifetime'])) {
                $this->_cache_lifetime = $params['cache_lifetime'];
                unset($params['cache_lifetime']);
            }
        }
        $this->_params = $params;
    }

Usage Example

Exemplo n.º 1
0
Arquivo: Owm.php Projeto: horde/horde
 /**
  * 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);
 }
All Usage Examples Of Horde_Service_Weather_Base::__construct