File indexing completed on 2024-12-29 05:28:01

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Service
0017  * @subpackage Ebay
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  * @version    $Id: Abstract.php 22824 2010-08-09 18:59:54Z renanbr $
0021  */
0022 
0023 /**
0024  * @see Zend_Service_Ebay_Finding_Abstract
0025  */
0026 // require_once 'Zend/Service/Ebay/Finding/Abstract.php';
0027 
0028 /**
0029  * @category   Zend
0030  * @package    Zend_Service
0031  * @subpackage Ebay
0032  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0033  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0034  * @uses       Zend_Service_Ebay_Finding_Abstract
0035  */
0036 abstract class Zend_Service_Ebay_Finding_Response_Abstract extends Zend_Service_Ebay_Finding_Abstract
0037 {
0038     /**
0039      * Indicates whether or not errors or warnings were generated during the
0040      * processing of the request.
0041      *
0042      * Applicable values:
0043      *
0044      *     Failure
0045      *     eBay encountered a fatal error during the processing of the request,
0046      *     causing the request to fail. When a serious application-level error
0047      *     occurs, the error is returned instead of the business data.
0048      *
0049      *     PartialFailure
0050      *     eBay successfully processed the request, but one or more non-fatal
0051      *     errors occurred during the processing. For best results, requests
0052      *     should return without warning messages. Inspect the message details
0053      *     and resolve any problems before resubmitting the request.
0054      *
0055      *     Success
0056      *     eBay successfully processed the request and the business data is
0057      *     returned in the response. Note that it is possible for a response to
0058      *     return Success, but still not contain the expected data in the result.
0059      *
0060      *     Warning
0061      *     The request was successfully processed, but eBay encountered a
0062      *     non-fatal error during the processing. For best results, requests
0063      *     should return without warnings. Inspect the warning details and
0064      *     resolve the problem before resubmitting the request.
0065      *
0066      * @var string
0067      */
0068     public $ack;
0069 
0070     /**
0071      * Information regarding an error or warning that occurred when eBay
0072      * processed the request.
0073      *
0074      * Not returned when the ack value is Success. Run-time errors are not
0075      * reported here.
0076      *
0077      * @var Zend_Service_Ebay_Finding_Error_Message
0078      */
0079     public $errorMessage;
0080 
0081     /**
0082      * This value represents the date and time when eBay processed the request.
0083      *
0084      * This value is returned in GMT, the ISO 8601 date and time format
0085      * (YYYY-MM-DDTHH:MM:SS.SSSZ). See the "dateTime" type for information about
0086      * the time format, and for details on converting to and from the GMT time
0087      * zone.
0088      *
0089      * @var string
0090      */
0091     public $timestamp;
0092 
0093     /**
0094      * The release version that eBay used to process the request.
0095      *
0096      * Developer Technical Support may ask you for the version value if you work
0097      * with them to troubleshoot issues.
0098      *
0099      * @var string
0100      */
0101     public $version;
0102 
0103     /**
0104      * @var string
0105      */
0106     protected $_operation;
0107 
0108     /**
0109      * @var array
0110      */
0111     protected $_options = array();
0112 
0113     /**
0114      * @return void
0115      */
0116     protected function _init()
0117     {
0118         parent::_init();
0119         $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
0120 
0121         $this->ack       = $this->_query(".//$ns:ack[1]", 'string');
0122         $this->timestamp = $this->_query(".//$ns:timestamp[1]", 'string');
0123         $this->version   = $this->_query(".//$ns:version[1]", 'string');
0124 
0125         $node = $this->_xPath->query(".//$ns:errorMessage[1]", $this->_dom)->item(0);
0126         if ($node) {
0127             /**
0128              * @see Zend_Service_Ebay_Finding_Error_Message
0129              */
0130             // require_once 'Zend/Service/Ebay/Finding/Error/Message.php';
0131             $this->errorMessage = new Zend_Service_Ebay_Finding_Error_Message($node);
0132         }
0133     }
0134 
0135     /**
0136      * @param  string $operation
0137      * @return Zend_Service_Ebay_Finding_Response_Abstract Provides a fluent interface
0138      */
0139     public function setOperation($operation)
0140     {
0141         $this->_operation = (string) $operation;
0142         return $this;
0143     }
0144 
0145     /**
0146      * @return string
0147      */
0148     public function getOperation()
0149     {
0150         return $this->_operation;
0151     }
0152 
0153     /**
0154      * @param  string|Zend_Config|array $name
0155      * @param  mixed                    $value
0156      * @return Zend_Service_Ebay_Finding_Response_Abstract Provides a fluent interface
0157      */
0158     public function setOption($name, $value = null)
0159     {
0160         if ($name instanceof Zend_Config) {
0161             $name = $name->toArray();
0162         }
0163         if (is_array($name)) {
0164             $this->_options = $name;
0165         } else {
0166             $this->_options[$name] = $value;
0167         }
0168         return $this;
0169     }
0170 
0171     /**
0172      * @param  string $name
0173      * @return mixed
0174      */
0175     public function getOption($name = null)
0176     {
0177         if (null === $name) {
0178             return $this->_options;
0179         }
0180         if (array_key_exists($name, $this->_options)) {
0181             return $this->_options[$name];
0182         }
0183         return null;
0184     }
0185 }