/** * Initialize key parameters of a RemoteQuery based adpater * * This will attempt to set host, user, and authentication information, as * well as port and protocol. User and authentication information may * retrieved from the environment context if that feature is enabled. * * @param Cpanel_Query_Http_Abstract $adapter Adapter to initialize * * @return Cpanel_Query_Http_Abstract Initialized adapter */ protected function initAdapter(Cpanel_Query_Http_Abstract $adapter) { $vars['host'] = $this->getOption('host'); $vars['user'] = $this->getOption('user'); if (!($vars['hash'] = $this->getOption('hash'))) { $vars['password'] = $this->getOption('password'); } else { $vars['password'] = null; } $vars['port'] = $this->getOption('port'); $vars['protocol'] = $this->getOption('protocol'); if (!$this->disableEnvironmentContext) { $vars = $this->_getEnvironmentContext($vars); } $adapter->init($vars['host'], $vars['user'], $vars['password']); if (!empty($vars['hash'])) { $adapter->setHash($vars['hash']); } if ($vars['port']) { $adapter->setPort($vars['port']); } elseif ($vars['protocol']) { $adapter->setProtocol($vars['protocol']); } return $adapter; }