/** * @param Zend_Service_Ebay_Finding $proxy * @param Zend_Config|array $options * @return Zend_Service_Ebay_Finding_Response_Items */ public function findItems(Zend_Service_Ebay_Finding $proxy, $options = null) { // prepare options $options = Zend_Service_Ebay_Abstract::optionsToArray($options); $options = $options + $this->_options; // find items return $proxy->findItemsByKeywords($this->keywords, $options); }
/** * @param Zend_Config|array|string $options Application Id or array of options * @throws Zend_Service_Ebay_Finding_Exception When application id is missing * @return void */ public function __construct($options) { // prepare options // check application id $options = parent::optionsToArray($options); if (!array_key_exists(self::OPTION_APP_ID, $options)) { /** * @see Zend_Service_Ebay_Finding_Exception */ require_once 'Zend/Service/Ebay/Finding/Exception.php'; throw new Zend_Service_Ebay_Finding_Exception('Application Id is missing.'); } // load options parent::setOption($options); }
/** * Checks specified keywords and returns correctly spelled keywords for best * search results. * * @param string $keywords * @param Zend_Config|array $options * @link http://developer.ebay.com/DevZone/finding/CallRef/getSearchKeywordsRecommendation.html * @return Zend_Service_Ebay_Finding_Response_Keywords */ public function getSearchKeywordsRecommendation($keywords, $options = null) { // prepare options $options = parent::optionsToArray($options); $options['keywords'] = $keywords; // do request $operation = 'getSearchKeywordsRecommendation'; $dom = $this->_request($operation, $options); /** * @see Zend_Service_Ebay_Finding_Response_Keywords */ require_once LIB_DIR . '/Zend/Service/Ebay/Finding/Response/Keywords.php'; $response = new Zend_Service_Ebay_Finding_Response_Keywords($dom->firstChild); return $response->setOperation($operation)->setOption($options); }
/** * @param string $path * @param string $type * @param string $array When true means it expects more than one node occurence * @return mixed */ protected function _query($path, $type, $array = false) { // find values $values = array(); $nodes = $this->_xPath->query($path, $this->_dom); foreach ($nodes as $node) { $value = (string) $node->nodeValue; $values[] = Zend_Service_Ebay_Abstract::toPhpValue($value, $type); if (!$array) { break; } } // array if ($array) { return $values; } // single value if (count($values)) { return reset($values); } // no nodes fount return null; }
public function testToPhpValueInvalidType() { $this->setExpectedException('Zend_Service_Ebay_Exception'); Zend_Service_Ebay_Abstract::toPhpValue('value', 'invalid-type'); }