Abstract.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id: Abstract.php 22824 2010-08-09 18:59:54Z 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-2015 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. abstract class Zend_Service_Ebay_Finding_Response_Abstract extends Zend_Service_Ebay_Finding_Abstract
  35. {
  36. /**
  37. * Indicates whether or not errors or warnings were generated during the
  38. * processing of the request.
  39. *
  40. * Applicable values:
  41. *
  42. * Failure
  43. * eBay encountered a fatal error during the processing of the request,
  44. * causing the request to fail. When a serious application-level error
  45. * occurs, the error is returned instead of the business data.
  46. *
  47. * PartialFailure
  48. * eBay successfully processed the request, but one or more non-fatal
  49. * errors occurred during the processing. For best results, requests
  50. * should return without warning messages. Inspect the message details
  51. * and resolve any problems before resubmitting the request.
  52. *
  53. * Success
  54. * eBay successfully processed the request and the business data is
  55. * returned in the response. Note that it is possible for a response to
  56. * return Success, but still not contain the expected data in the result.
  57. *
  58. * Warning
  59. * The request was successfully processed, but eBay encountered a
  60. * non-fatal error during the processing. For best results, requests
  61. * should return without warnings. Inspect the warning details and
  62. * resolve the problem before resubmitting the request.
  63. *
  64. * @var string
  65. */
  66. public $ack;
  67. /**
  68. * Information regarding an error or warning that occurred when eBay
  69. * processed the request.
  70. *
  71. * Not returned when the ack value is Success. Run-time errors are not
  72. * reported here.
  73. *
  74. * @var Zend_Service_Ebay_Finding_Error_Message
  75. */
  76. public $errorMessage;
  77. /**
  78. * This value represents the date and time when eBay processed the request.
  79. *
  80. * This value is returned in GMT, the ISO 8601 date and time format
  81. * (YYYY-MM-DDTHH:MM:SS.SSSZ). See the "dateTime" type for information about
  82. * the time format, and for details on converting to and from the GMT time
  83. * zone.
  84. *
  85. * @var string
  86. */
  87. public $timestamp;
  88. /**
  89. * The release version that eBay used to process the request.
  90. *
  91. * Developer Technical Support may ask you for the version value if you work
  92. * with them to troubleshoot issues.
  93. *
  94. * @var string
  95. */
  96. public $version;
  97. /**
  98. * @var string
  99. */
  100. protected $_operation;
  101. /**
  102. * @var array
  103. */
  104. protected $_options = array();
  105. /**
  106. * @return void
  107. */
  108. protected function _init()
  109. {
  110. parent::_init();
  111. $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
  112. $this->ack = $this->_query(".//$ns:ack[1]", 'string');
  113. $this->timestamp = $this->_query(".//$ns:timestamp[1]", 'string');
  114. $this->version = $this->_query(".//$ns:version[1]", 'string');
  115. $node = $this->_xPath->query(".//$ns:errorMessage[1]", $this->_dom)->item(0);
  116. if ($node) {
  117. /**
  118. * @see Zend_Service_Ebay_Finding_Error_Message
  119. */
  120. require_once 'Zend/Service/Ebay/Finding/Error/Message.php';
  121. $this->errorMessage = new Zend_Service_Ebay_Finding_Error_Message($node);
  122. }
  123. }
  124. /**
  125. * @param string $operation
  126. * @return Zend_Service_Ebay_Finding_Response_Abstract Provides a fluent interface
  127. */
  128. public function setOperation($operation)
  129. {
  130. $this->_operation = (string) $operation;
  131. return $this;
  132. }
  133. /**
  134. * @return string
  135. */
  136. public function getOperation()
  137. {
  138. return $this->_operation;
  139. }
  140. /**
  141. * @param string|Zend_Config|array $name
  142. * @param mixed $value
  143. * @return Zend_Service_Ebay_Finding_Response_Abstract Provides a fluent interface
  144. */
  145. public function setOption($name, $value = null)
  146. {
  147. if ($name instanceof Zend_Config) {
  148. $name = $name->toArray();
  149. }
  150. if (is_array($name)) {
  151. $this->_options = $name;
  152. } else {
  153. $this->_options[$name] = $value;
  154. }
  155. return $this;
  156. }
  157. /**
  158. * @param string $name
  159. * @return mixed
  160. */
  161. public function getOption($name = null)
  162. {
  163. if (null === $name) {
  164. return $this->_options;
  165. }
  166. if (array_key_exists($name, $this->_options)) {
  167. return $this->_options[$name];
  168. }
  169. return null;
  170. }
  171. }