Container.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Service
  17. * @subpackage Ebay
  18. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id: Container.php 22791 2010-08-04 16:11:47Z renanbr $
  21. */
  22. /**
  23. * @see Zend_Service_Ebay_Finding_Abstract
  24. */
  25. require_once 'Zend/Service/Ebay/Finding/Abstract.php';
  26. /**
  27. * @category Zend
  28. * @package Zend_Service
  29. * @subpackage Ebay
  30. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  31. * @license http://framework.zend.com/license/new-bsd New BSD License
  32. * @uses Zend_Service_Ebay_Finding_Abstract
  33. */
  34. class Zend_Service_Ebay_Finding_Aspect_Histogram_Container extends Zend_Service_Ebay_Finding_Abstract
  35. {
  36. /**
  37. * A characteristic of an item in a domain.
  38. *
  39. * For example, "Optical Zoom", "Brand", and "Megapixels" could be aspects
  40. * of the Digital Cameras domain. Aspects are well-known, standardized
  41. * characteristics of a domain, and they vary from domain to domain (the
  42. * aspects of "Men's Shoes" are different from those of "Digital Cameras").
  43. * A search request on the eBay site will often display aspects and their
  44. * respective aspect values on the left-had side of a query response.
  45. *
  46. * Aspects are extracted from item listing properties (such as item titles
  47. * and subtitles), and represent the characteristics of active items. Values
  48. * returned in the Aspect container can be used as inputs to the
  49. * aspectFilter fields in a query to distill the items returned by the
  50. * query. eBay generates aspects dynamically from the items currently
  51. * listed; aspects provide a view into what is currently available on eBay.
  52. * Because of this, aspect values returned one day cannot be guaranteed to
  53. * be valid the next day.
  54. *
  55. * @var Zend_Service_Ebay_Finding_Aspect_Set
  56. */
  57. public $aspect;
  58. /**
  59. * Names of aspects that is part of a domain.
  60. *
  61. * Use array key to associate a name from this attribute to aspect set. This
  62. * value is not returned if there are no matching aspects for the associated
  63. * domain.
  64. *
  65. * For example, "Optical Zoom" or "Megapixels" could be aspects of the
  66. * Digital Cameras domain. For the current aspect names associated with a
  67. * specific item, refer to the aspectHistogramContainer returned for the
  68. * respective item.
  69. *
  70. * @var string[]
  71. */
  72. public $aspect_name = array();
  73. /**
  74. * A buy-side group of items, for example "Shoes.".
  75. *
  76. * Domains are extracted from item listing properties, such as the title,
  77. * descriptions, and so on.
  78. *
  79. * @var string
  80. */
  81. public $domainDisplayName;
  82. /**
  83. * A buy-side group of items that share aspects, but not necessarily an eBay
  84. * category.
  85. *
  86. * For example "Women's Dresses" or "Digital Cameras" could be domains. You
  87. * can use a domainName to label a set of aspects that you display.
  88. *
  89. * @var string
  90. */
  91. public $domainName;
  92. /**
  93. * @return void
  94. */
  95. protected function _init()
  96. {
  97. parent::_init();
  98. $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
  99. $this->aspect_name = $this->_query(".//$ns:aspect/@name", 'string', true);
  100. $this->domainDisplayName = $this->_query(".//$ns:domainDisplayName[1]", 'string');
  101. $this->domainName = $this->_query(".//$ns:domainName[1]", 'string');
  102. $nodes = $this->_xPath->query(".//$ns:aspect", $this->_dom);
  103. if ($nodes->length > 0) {
  104. /**
  105. * @see Zend_Service_Ebay_Finding_Aspect_Set
  106. */
  107. require_once 'Zend/Service/Ebay/Finding/Aspect/Set.php';
  108. $this->aspect = new Zend_Service_Ebay_Finding_Aspect_Set($nodes);
  109. }
  110. }
  111. }