• amazonservices api 抽象类 Class Abstraction


    http://php.net/manual/zh/language.oop5.abstract.php

    MWSOrdersPHPClientLibrary-2013-09-01._V533357711_srcMarketplaceWebServiceOrdersModel.php

    <?php
    /*******************************************************************************
     * Copyright 2009-2017 Amazon Services. All Rights Reserved.
     * Licensed under the Apache License, Version 2.0 (the "License");
     *
     * You may not use this file except in compliance with the License.
     * You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
     * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
     * CONDITIONS OF ANY KIND, either express or implied. See the License for the
     * specific language governing permissions and limitations under the License.
     *******************************************************************************
     * PHP Version 5
     * @category Amazon
     * @package  Marketplace Web Service Orders
     * @version  2013-09-01
     * Library Version: 2017-02-22
     * Generated: Thu Mar 02 12:41:08 UTC 2017
     */
    
    /**
     * MarketplaceWebServiceOrders_Model - base class for all model classes
     */
    abstract class MarketplaceWebServiceOrders_Model
    {
    
        /** @var array */
        protected $_fields = array();
    
        /**
         * Construct new model class
         *
         * @param mixed $data - DOMElement or Associative Array to construct from.
         */
        public function __construct($data = null)
        {
            if (!is_null($data)) {
                if ($this->_isAssociativeArray($data)) {
                    $this->_fromAssociativeArray($data);
                } elseif ($this->_isDOMElement($data)) {
                    $this->_fromDOMElement($data);
                } else {
                    throw new Exception ("Unable to construct from provided data. Please be sure to pass associative array or DOMElement");
                }
            }
        }
    
        /**
         * Support for virtual properties getters.
         *
         * Virtual property call example:
         *
         *   $action->Property
         *
         * Direct getter(preferred):
         *
         *   $action->getProperty()
         *
         * @param string $propertyName name of the property
         */
        public function __get($propertyName)
        {
            $getter = "get$propertyName";
            return $this->$getter();
        }
    
        /**
         * Support for virtual properties setters.
         *
         * Virtual property call example:
         *
         *   $action->Property  = 'ABC'
         *
         * Direct setter (preferred):
         *
         *   $action->setProperty('ABC')
         *
         * @param string $propertyName name of the property
         */
        public function __set($propertyName, $propertyValue)
        {
            $setter = "set$propertyName";
            $this->$setter($propertyValue);
            return $this;
        }
    
        /**
         * Construct from DOMElement
         *
         * This function iterates over object fields and queries XML
         * for corresponding tag value. If query succeeds, value extracted
         * from xml, and field value properly constructed based on field type.
         *
         * Field types defined as arrays always constructed as arrays,
         * even if XML contains a single element - to make sure that
         * data structure is predictable, and no is_array checks are
         * required.
         *
         * @param DOMElement $dom XML element to construct from
         */
        private function _fromDOMElement(DOMElement $dom)
        {
            $xpath = new DOMXPath($dom->ownerDocument);
    
            foreach ($this->_fields as $fieldName => $field) {
                $fieldType = $field['FieldType'];
                if (is_array($fieldType)) {
                    if ($fieldType[0] == "object") {
                        $elements = $dom->childNodes;
                        for ($i = 0; $i < $elements->length; $i++) {
                            $this->_fields[$fieldName]['FieldValue'][] = $elements->item($i);
                        }
                    } else if ($this->_isComplexType($fieldType[0])) {
                        if (isset($field['ListMemberName'])) {
                            $memberName = $field['ListMemberName'];
                            $elements = $xpath->query("./*[local-name()='$fieldName']/*[local-name()='$memberName']", $dom);
                        } else {
                            $elements = $xpath->query("./*[local-name()='$fieldName']", $dom);
                        }
                        if ($elements->length >= 1) {
                            require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $fieldType[0]) . ".php");
                            foreach ($elements as $element) {
                                $this->_fields[$fieldName]['FieldValue'][] = new $fieldType[0]($element);
                            }
                        }
                    } else {
                        if (isset($field['ListMemberName'])) {
                            $memberName = $field['ListMemberName'];
                            $elements = $xpath->query("./*[local-name()='$fieldName']/*[local-name()='$memberName']", $dom);
                        } else {
                            $elements = $xpath->query("./*[local-name()='$fieldName']", $dom);
                        }
                        if ($elements->length >= 1) {
                            foreach ($elements as $element) {
                                $text = $xpath->query('./text()', $element);
                                $this->_fields[$fieldName]['FieldValue'][] = $text->item(0)->data;
                            }
                        }
                    }
                } else {
                    if ($this->_isComplexType($fieldType)) {
                        $elements = $xpath->query("./*[local-name()='$fieldName']", $dom);
                        if ($elements->length == 1) {
                            require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $fieldType) . ".php");
                            $this->_fields[$fieldName]['FieldValue'] = new $fieldType($elements->item(0));
                        }
                    } else {
                        if ($fieldType[0] == "@") {
                            $attribute = $xpath->query("./@$fieldName", $dom);
                            if ($attribute->length == 1) {
                                $this->_fields[$fieldName]['FieldValue'] = $attribute->item(0)->nodeValue;
                                if (isset ($this->_fields['Value'])) {
                                    $parentNode = $attribute->item(0)->parentNode;
                                    $this->_fields['Value']['FieldValue'] = $parentNode->nodeValue;
                                }
                            }
                        } else {
                            if ($fieldType[0] == ".") {
                                $element = $xpath->query("./text()", $dom);
                            } else {
                                $element = $xpath->query("./*[local-name()='$fieldName']/text()", $dom);
                            }
                            if ($element->length == 1) {
                                $this->_fields[$fieldName]['FieldValue'] = $element->item(0)->data;
                            }
                        }
    
                        $attribute = $xpath->query("./@$fieldName", $dom);
                        if ($attribute->length == 1) {
                            $this->_fields[$fieldName]['FieldValue'] = $attribute->item(0)->nodeValue;
                            if (isset ($this->_fields['Value'])) {
                                $parentNode = $attribute->item(0)->parentNode;
                                $this->_fields['Value']['FieldValue'] = $parentNode->nodeValue;
                            }
                        }
    
                    }
                }
            }
        }
    
    
        /**
         * Construct from Associative Array
         *
         *
         * @param array $array associative array to construct from
         */
        private function _fromAssociativeArray(array $array)
        {
            foreach ($this->_fields as $fieldName => $field) {
                $fieldType = $field['FieldType'];
                if (is_array($fieldType)) {
                    if ($this->_isComplexType($fieldType[0])) {
                        if (array_key_exists($fieldName, $array)) {
                            $elements = $array[$fieldName];
                            if (!$this->_isNumericArray($elements)) {
                                $elements = array($elements);
                            }
                            if (count($elements) >= 1) {
                                require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $fieldType[0]) . ".php");
    
                                foreach ($elements as $element) {
                                    $this->_fields[$fieldName]['FieldValue'][] = new $fieldType[0]($element);
                                }
                            }
                        }
                    } else {
                        if (array_key_exists($fieldName, $array)) {
                            $elements = $array[$fieldName];
                            if (!$this->_isNumericArray($elements)) {
                                $elements = array($elements);
                            }
                            if (count($elements) >= 1) {
                                foreach ($elements as $element) {
                                    $this->_fields[$fieldName]['FieldValue'][] = $element;
                                }
                            }
                        }
                    }
                } else {
                    if ($this->_isComplexType($fieldType)) {
                        if (array_key_exists($fieldName, $array)) {
                            require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $fieldType) . ".php");
                            $this->_fields[$fieldName]['FieldValue'] = new $fieldType($array[$fieldName]);
                        }
                    } else {
                        if (array_key_exists($fieldName, $array)) {
                            $this->_fields[$fieldName]['FieldValue'] = $array[$fieldName];
                        }
                    }
                }
            }
        }
    
        /**
         * Convert to query parameters suitable for POSTing.
         * @return array of query parameters
         */
        public function toQueryParameterArray()
        {
            return $this->_toQueryParameterArray("");
        }
    
        protected function _toQueryParameterArray($prefix)
        {
            $arr = array();
            foreach ($this->_fields as $fieldName => $fieldAttrs) {
                $fieldType = $fieldAttrs['FieldType'];
                $fieldValue = $fieldAttrs['FieldValue'];
                $newPrefix = $prefix . $fieldName . '.';
                $currentArr = $this->__toQueryParameterArray($newPrefix, $fieldType, $fieldValue, $fieldAttrs);
                $arr = array_merge($arr, $currentArr);
            }
            return $arr;
        }
    
        private function __toQueryParameterArray($prefix, $fieldType, $fieldValue, $fieldAttrs)
        {
            $arr = array();
            if (is_array($fieldType)) {
                if (isset($fieldAttrs['ListMemberName'])) {
                    $listMemberName = $fieldAttrs['ListMemberName'];
                    $itemPrefix = $prefix . $listMemberName . '.';
                } else {
                    $itemPrefix = $prefix;
                }
    
                for ($i = 1; $i <= count($fieldValue); $i++) {
                    $indexedPrefix = $itemPrefix . $i . '.';
                    $memberType = $fieldType[0];
                    $arr = array_merge($arr,
                        $this->__toQueryParameterArray($indexedPrefix,
                            $memberType, $fieldValue[$i - 1], null));
                }
    
            } else if ($this->_isComplexType($fieldType)) {
                // Struct
                if (isset($fieldValue)) {
                    $arr = array_merge($arr, $fieldValue->_toQueryParameterArray($prefix));
                }
            } else {
                // Primitive
                if ($fieldValue !== null && $fieldValue !== "") {
                    if ($fieldType == 'bool') {
                        $fieldValue = ($fieldValue) ? 'true' : 'false';
                    }
                    $arr[rtrim($prefix, '.')] = $fieldValue;
                }
            }
            return $arr;
        }
    
        /**
         * XML fragment representation of this object
         * Note, name of the root determined by caller
         * This fragment returns inner fields representation only
         * @return string XML fragment for this object
         */
        protected function _toXMLFragment()
        {
            $xml = "";
            foreach ($this->_fields as $fieldName => $field) {
                $fieldValue = $field['FieldValue'];
                if (!is_null($fieldValue) && $field['FieldType'] != "MarketplaceWebServiceOrders_Model_ResponseHeaderMetadata") {
                    $fieldType = $field['FieldType'];
                    if (is_array($fieldType)) {
                        if ($fieldType[0] == "object") {
                            foreach ($fieldValue as $item) {
                                $newDoc = new DOMDocument();
                                $importedNode = $newDoc->importNode($item, true);
                                $newDoc->appendChild($importedNode);
                                $xmlStr = $newDoc->saveXML();
                                $xmlStr = substr($xmlStr, strpos($xmlStr, "?>") + 2);
                                $xml .= trim($xmlStr);
                            }
                        } else if ($this->_isComplexType($fieldType[0])) {
                            if (isset($field['ListMemberName'])) {
                                $memberName = $field['ListMemberName'];
                                $xml .= "<$fieldName>";
                                foreach ($fieldValue as $item) {
                                    $xml .= "<$memberName>";
                                    $xml .= $item->_toXMLFragment();
                                    $xml .= "</$memberName>";
                                }
                                $xml .= "</$fieldName>";
                            } else {
                                foreach ($fieldValue as $item) {
                                    $xml .= "<$fieldName";
                                    $xml .= $item->_getAttributes();
                                    $xml .= ">";
                                    $xml .= $item->_toXMLFragment();
                                    $xml .= "</$fieldName>";
                                }
                            }
                        } else {
                            if (isset($field['ListMemberName'])) {
                                $memberName = $field['ListMemberName'];
                                $xml .= "<$fieldName>";
                                foreach ($fieldValue as $item) {
                                    $xml .= "<$memberName>";
                                    $xml .= $this->_escapeXML($item);
                                    $xml .= "</$memberName>";
                                }
                                $xml .= "</$fieldName>";
                            } else {
                                foreach ($fieldValue as $item) {
                                    $xml .= "<$fieldName>";
                                    $xml .= $this->_escapeXML($item);
                                    $xml .= "</$fieldName>";
                                }
                            }
                        }
                    } else {
                        if ($this->_isComplexType($fieldType)) {
                            $xml .= "<$fieldName";
                            $xml .= $fieldValue->_getAttributes();
                            $xml .= ">";
                            $xml .= $fieldValue->_toXMLFragment();
                            $xml .= "</$fieldName>";
                        } else if ($fieldType[0] == ".") {
                            $xml .= $this->_escapeXML($fieldValue);
                        } else if ($fieldType[0] != "@") {
                            $xml .= "<$fieldName>";
                            $xml .= $this->_escapeXML($fieldValue);
                            $xml .= "</$fieldName>";
                        }
                    }
                }
            }
            return $xml;
        }
    
        protected function _getAttributes()
        {
            $xml = "";
            foreach ($this->_fields as $fieldName => $field) {
                $fieldValue = $field['FieldValue'];
                if (!is_null($fieldValue)) {
                    $fieldType = $field['FieldType'];
                    if ($fieldType[0] == "@") {
                        $xml .= " " . $fieldName . "='" . $this->_escapeXML($fieldValue) . "'";
                    }
                }
            }
            return $xml;
        }
    
        /**
         * Escape special XML characters
         * @return string with escaped XML characters
         */
        private function _escapeXML($str)
        {
            $from = array("&", "<", ">", "'", """);
            $to = array("&amp;", "&lt;", "&gt;", "&#039;", "&quot;");
            return str_replace($from, $to, $str);
        }
    
        /**
         * Determines if field is complex type
         *
         * @param string $fieldType field type name
         */
        private function _isComplexType($fieldType)
        {
            return preg_match("/^MarketplaceWebServiceOrders_/", $fieldType);
        }
    
        /**
         * Checks  whether passed variable is an associative array
         *
         * @param mixed $var
         * @return TRUE if passed variable is an associative array
         */
        private function _isAssociativeArray($var)
        {
            return is_array($var) && array_keys($var) !== range(0, sizeof($var) - 1);
        }
    
        /**
         * Checks  whether passed variable is DOMElement
         *
         * @param mixed $var
         * @return TRUE if passed variable is DOMElement
         */
        private function _isDOMElement($var)
        {
            return $var instanceof DOMElement;
        }
    
        /**
         * Checks  whether passed variable is numeric array
         *
         * @param mixed $var
         * @return TRUE if passed variable is an numeric array
         */
        protected function _isNumericArray($var)
        {
            if (!is_array($var)) {
                return false;
            }
            $sz = sizeof($var);
            return ($sz === 0 || array_keys($var) === range(0, sizeof($var) - 1));
        }
    
    }

    MWSOrdersPHPClientLibrary-2013-09-01._V533357711_srcMarketplaceWebServiceOrdersModelListOrderRequest.php

    <?php
    /*******************************************************************************
     * Copyright 2009-2017 Amazon Services. All Rights Reserved.
     * Licensed under the Apache License, Version 2.0 (the "License");
     *
     * You may not use this file except in compliance with the License.
     * You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
     * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
     * CONDITIONS OF ANY KIND, either express or implied. See the License for the
     * specific language governing permissions and limitations under the License.
     *******************************************************************************
     * PHP Version 5
     * @category Amazon
     * @package  Marketplace Web Service Orders
     * @version  2013-09-01
     * Library Version: 2017-02-22
     * Generated: Thu Mar 02 12:41:08 UTC 2017
     */
    
    /**
     * @see MarketplaceWebServiceOrders_Model
     */
    
    require_once(dirname(__FILE__) . '/../Model.php');
    
    
    /**
     * MarketplaceWebServiceOrders_Model_ListOrdersRequest
     *
     * Properties:
     * <ul>
     *
     * <li>SellerId: string</li>
     * <li>MWSAuthToken: string</li>
     * <li>CreatedAfter: string</li>
     * <li>CreatedBefore: string</li>
     * <li>LastUpdatedAfter: string</li>
     * <li>LastUpdatedBefore: string</li>
     * <li>OrderStatus: array</li>
     * <li>MarketplaceId: array</li>
     * <li>FulfillmentChannel: array</li>
     * <li>PaymentMethod: array</li>
     * <li>BuyerEmail: string</li>
     * <li>SellerOrderId: string</li>
     * <li>MaxResultsPerPage: int</li>
     * <li>TFMShipmentStatus: array</li>
     *
     * </ul>
     */
    class MarketplaceWebServiceOrders_Model_ListOrdersRequest extends MarketplaceWebServiceOrders_Model
    {
    
        public function __construct($data = null)
        {
            $this->_fields = array(
                'SellerId' => array('FieldValue' => null, 'FieldType' => 'string'),
                'MWSAuthToken' => array('FieldValue' => null, 'FieldType' => 'string'),
                'CreatedAfter' => array('FieldValue' => null, 'FieldType' => 'string'),
                'CreatedBefore' => array('FieldValue' => null, 'FieldType' => 'string'),
                'LastUpdatedAfter' => array('FieldValue' => null, 'FieldType' => 'string'),
                'LastUpdatedBefore' => array('FieldValue' => null, 'FieldType' => 'string'),
                'OrderStatus' => array('FieldValue' => array(), 'FieldType' => array('string'), 'ListMemberName' => 'Status'),
                'MarketplaceId' => array('FieldValue' => array(), 'FieldType' => array('string'), 'ListMemberName' => 'Id'),
                'FulfillmentChannel' => array('FieldValue' => array(), 'FieldType' => array('string'), 'ListMemberName' => 'Channel'),
                'PaymentMethod' => array('FieldValue' => array(), 'FieldType' => array('string'), 'ListMemberName' => 'Method'),
                'BuyerEmail' => array('FieldValue' => null, 'FieldType' => 'string'),
                'SellerOrderId' => array('FieldValue' => null, 'FieldType' => 'string'),
                'MaxResultsPerPage' => array('FieldValue' => null, 'FieldType' => 'int'),
                'TFMShipmentStatus' => array('FieldValue' => array(), 'FieldType' => array('string'), 'ListMemberName' => 'Status'),
            );
            parent::__construct($data);
        }
    
        /**
         * Get the value of the SellerId property.
         *
         * @return String SellerId.
         */
        public function getSellerId()
        {
            return $this->_fields['SellerId']['FieldValue'];
        }
    
        /**
         * Set the value of the SellerId property.
         *
         * @param string sellerId
         * @return this instance
         */
        public function setSellerId($value)
        {
            $this->_fields['SellerId']['FieldValue'] = $value;
            return $this;
        }
    
        /**
         * Check to see if SellerId is set.
         *
         * @return true if SellerId is set.
         */
        public function isSetSellerId()
        {
            return !is_null($this->_fields['SellerId']['FieldValue']);
        }
    
        /**
         * Set the value of SellerId, return this.
         *
         * @param sellerId
         *             The new value to set.
         *
         * @return This instance.
         */
        public function withSellerId($value)
        {
            $this->setSellerId($value);
            return $this;
        }
    
        /**
         * Get the value of the MWSAuthToken property.
         *
         * @return String MWSAuthToken.
         */
        public function getMWSAuthToken()
        {
            return $this->_fields['MWSAuthToken']['FieldValue'];
        }
    
        /**
         * Set the value of the MWSAuthToken property.
         *
         * @param string mwsAuthToken
         * @return this instance
         */
        public function setMWSAuthToken($value)
        {
            $this->_fields['MWSAuthToken']['FieldValue'] = $value;
            return $this;
        }
    
        /**
         * Check to see if MWSAuthToken is set.
         *
         * @return true if MWSAuthToken is set.
         */
        public function isSetMWSAuthToken()
        {
            return !is_null($this->_fields['MWSAuthToken']['FieldValue']);
        }
    
        /**
         * Set the value of MWSAuthToken, return this.
         *
         * @param mwsAuthToken
         *             The new value to set.
         *
         * @return This instance.
         */
        public function withMWSAuthToken($value)
        {
            $this->setMWSAuthToken($value);
            return $this;
        }
    
        /**
         * Get the value of the CreatedAfter property.
         *
         * @return XMLGregorianCalendar CreatedAfter.
         */
        public function getCreatedAfter()
        {
            return $this->_fields['CreatedAfter']['FieldValue'];
        }
    
        /**
         * Set the value of the CreatedAfter property.
         *
         * @param string createdAfter
         * @return this instance
         */
        public function setCreatedAfter($value)
        {
            $this->_fields['CreatedAfter']['FieldValue'] = $value;
            return $this;
        }
    
        /**
         * Check to see if CreatedAfter is set.
         *
         * @return true if CreatedAfter is set.
         */
        public function isSetCreatedAfter()
        {
            return !is_null($this->_fields['CreatedAfter']['FieldValue']);
        }
    
        /**
         * Set the value of CreatedAfter, return this.
         *
         * @param createdAfter
         *             The new value to set.
         *
         * @return This instance.
         */
        public function withCreatedAfter($value)
        {
            $this->setCreatedAfter($value);
            return $this;
        }
    
        /**
         * Get the value of the CreatedBefore property.
         *
         * @return XMLGregorianCalendar CreatedBefore.
         */
        public function getCreatedBefore()
        {
            return $this->_fields['CreatedBefore']['FieldValue'];
        }
    
        /**
         * Set the value of the CreatedBefore property.
         *
         * @param string createdBefore
         * @return this instance
         */
        public function setCreatedBefore($value)
        {
            $this->_fields['CreatedBefore']['FieldValue'] = $value;
            return $this;
        }
    
        /**
         * Check to see if CreatedBefore is set.
         *
         * @return true if CreatedBefore is set.
         */
        public function isSetCreatedBefore()
        {
            return !is_null($this->_fields['CreatedBefore']['FieldValue']);
        }
    
        /**
         * Set the value of CreatedBefore, return this.
         *
         * @param createdBefore
         *             The new value to set.
         *
         * @return This instance.
         */
        public function withCreatedBefore($value)
        {
            $this->setCreatedBefore($value);
            return $this;
        }
    
        /**
         * Get the value of the LastUpdatedAfter property.
         *
         * @return XMLGregorianCalendar LastUpdatedAfter.
         */
        public function getLastUpdatedAfter()
        {
            return $this->_fields['LastUpdatedAfter']['FieldValue'];
        }
    
        /**
         * Set the value of the LastUpdatedAfter property.
         *
         * @param string lastUpdatedAfter
         * @return this instance
         */
        public function setLastUpdatedAfter($value)
        {
            $this->_fields['LastUpdatedAfter']['FieldValue'] = $value;
            return $this;
        }
    
        /**
         * Check to see if LastUpdatedAfter is set.
         *
         * @return true if LastUpdatedAfter is set.
         */
        public function isSetLastUpdatedAfter()
        {
            return !is_null($this->_fields['LastUpdatedAfter']['FieldValue']);
        }
    
        /**
         * Set the value of LastUpdatedAfter, return this.
         *
         * @param lastUpdatedAfter
         *             The new value to set.
         *
         * @return This instance.
         */
        public function withLastUpdatedAfter($value)
        {
            $this->setLastUpdatedAfter($value);
            return $this;
        }
    
        /**
         * Get the value of the LastUpdatedBefore property.
         *
         * @return XMLGregorianCalendar LastUpdatedBefore.
         */
        public function getLastUpdatedBefore()
        {
            return $this->_fields['LastUpdatedBefore']['FieldValue'];
        }
    
        /**
         * Set the value of the LastUpdatedBefore property.
         *
         * @param string lastUpdatedBefore
         * @return this instance
         */
        public function setLastUpdatedBefore($value)
        {
            $this->_fields['LastUpdatedBefore']['FieldValue'] = $value;
            return $this;
        }
    
        /**
         * Check to see if LastUpdatedBefore is set.
         *
         * @return true if LastUpdatedBefore is set.
         */
        public function isSetLastUpdatedBefore()
        {
            return !is_null($this->_fields['LastUpdatedBefore']['FieldValue']);
        }
    
        /**
         * Set the value of LastUpdatedBefore, return this.
         *
         * @param lastUpdatedBefore
         *             The new value to set.
         *
         * @return This instance.
         */
        public function withLastUpdatedBefore($value)
        {
            $this->setLastUpdatedBefore($value);
            return $this;
        }
    
        /**
         * Get the value of the OrderStatus property.
         *
         * @return List<String> OrderStatus.
         */
        public function getOrderStatus()
        {
            if ($this->_fields['OrderStatus']['FieldValue'] == null) {
                $this->_fields['OrderStatus']['FieldValue'] = array();
            }
            return $this->_fields['OrderStatus']['FieldValue'];
        }
    
        /**
         * Set the value of the OrderStatus property.
         *
         * @param array orderStatus
         * @return this instance
         */
        public function setOrderStatus($value)
        {
            if (!$this->_isNumericArray($value)) {
                $value = array($value);
            }
            $this->_fields['OrderStatus']['FieldValue'] = $value;
            return $this;
        }
    
        /**
         * Clear OrderStatus.
         */
        public function unsetOrderStatus()
        {
            $this->_fields['OrderStatus']['FieldValue'] = array();
        }
    
        /**
         * Check to see if OrderStatus is set.
         *
         * @return true if OrderStatus is set.
         */
        public function isSetOrderStatus()
        {
            return !empty($this->_fields['OrderStatus']['FieldValue']);
        }
    
        /**
         * Add values for OrderStatus, return this.
         *
         * @param orderStatus
         *             New values to add.
         *
         * @return This instance.
         */
        public function withOrderStatus()
        {
            foreach (func_get_args() as $OrderStatus) {
                $this->_fields['OrderStatus']['FieldValue'][] = $OrderStatus;
            }
            return $this;
        }
    
        /**
         * Get the value of the MarketplaceId property.
         *
         * @return List<String> MarketplaceId.
         */
        public function getMarketplaceId()
        {
            if ($this->_fields['MarketplaceId']['FieldValue'] == null) {
                $this->_fields['MarketplaceId']['FieldValue'] = array();
            }
            return $this->_fields['MarketplaceId']['FieldValue'];
        }
    
        /**
         * Set the value of the MarketplaceId property.
         *
         * @param array marketplaceId
         * @return this instance
         */
        public function setMarketplaceId($value)
        {
            if (!$this->_isNumericArray($value)) {
                $value = array($value);
            }
            $this->_fields['MarketplaceId']['FieldValue'] = $value;
            return $this;
        }
    
        /**
         * Clear MarketplaceId.
         */
        public function unsetMarketplaceId()
        {
            $this->_fields['MarketplaceId']['FieldValue'] = array();
        }
    
        /**
         * Check to see if MarketplaceId is set.
         *
         * @return true if MarketplaceId is set.
         */
        public function isSetMarketplaceId()
        {
            return !empty($this->_fields['MarketplaceId']['FieldValue']);
        }
    
        /**
         * Add values for MarketplaceId, return this.
         *
         * @param marketplaceId
         *             New values to add.
         *
         * @return This instance.
         */
        public function withMarketplaceId()
        {
            foreach (func_get_args() as $MarketplaceId) {
                $this->_fields['MarketplaceId']['FieldValue'][] = $MarketplaceId;
            }
            return $this;
        }
    
        /**
         * Get the value of the FulfillmentChannel property.
         *
         * @return List<String> FulfillmentChannel.
         */
        public function getFulfillmentChannel()
        {
            if ($this->_fields['FulfillmentChannel']['FieldValue'] == null) {
                $this->_fields['FulfillmentChannel']['FieldValue'] = array();
            }
            return $this->_fields['FulfillmentChannel']['FieldValue'];
        }
    
        /**
         * Set the value of the FulfillmentChannel property.
         *
         * @param array fulfillmentChannel
         * @return this instance
         */
        public function setFulfillmentChannel($value)
        {
            if (!$this->_isNumericArray($value)) {
                $value = array($value);
            }
            $this->_fields['FulfillmentChannel']['FieldValue'] = $value;
            return $this;
        }
    
        /**
         * Clear FulfillmentChannel.
         */
        public function unsetFulfillmentChannel()
        {
            $this->_fields['FulfillmentChannel']['FieldValue'] = array();
        }
    
        /**
         * Check to see if FulfillmentChannel is set.
         *
         * @return true if FulfillmentChannel is set.
         */
        public function isSetFulfillmentChannel()
        {
            return !empty($this->_fields['FulfillmentChannel']['FieldValue']);
        }
    
        /**
         * Add values for FulfillmentChannel, return this.
         *
         * @param fulfillmentChannel
         *             New values to add.
         *
         * @return This instance.
         */
        public function withFulfillmentChannel()
        {
            foreach (func_get_args() as $FulfillmentChannel) {
                $this->_fields['FulfillmentChannel']['FieldValue'][] = $FulfillmentChannel;
            }
            return $this;
        }
    
        /**
         * Get the value of the PaymentMethod property.
         *
         * @return List<String> PaymentMethod.
         */
        public function getPaymentMethod()
        {
            if ($this->_fields['PaymentMethod']['FieldValue'] == null) {
                $this->_fields['PaymentMethod']['FieldValue'] = array();
            }
            return $this->_fields['PaymentMethod']['FieldValue'];
        }
    
        /**
         * Set the value of the PaymentMethod property.
         *
         * @param array paymentMethod
         * @return this instance
         */
        public function setPaymentMethod($value)
        {
            if (!$this->_isNumericArray($value)) {
                $value = array($value);
            }
            $this->_fields['PaymentMethod']['FieldValue'] = $value;
            return $this;
        }
    
        /**
         * Clear PaymentMethod.
         */
        public function unsetPaymentMethod()
        {
            $this->_fields['PaymentMethod']['FieldValue'] = array();
        }
    
        /**
         * Check to see if PaymentMethod is set.
         *
         * @return true if PaymentMethod is set.
         */
        public function isSetPaymentMethod()
        {
            return !empty($this->_fields['PaymentMethod']['FieldValue']);
        }
    
        /**
         * Add values for PaymentMethod, return this.
         *
         * @param paymentMethod
         *             New values to add.
         *
         * @return This instance.
         */
        public function withPaymentMethod()
        {
            foreach (func_get_args() as $PaymentMethod) {
                $this->_fields['PaymentMethod']['FieldValue'][] = $PaymentMethod;
            }
            return $this;
        }
    
        /**
         * Get the value of the BuyerEmail property.
         *
         * @return String BuyerEmail.
         */
        public function getBuyerEmail()
        {
            return $this->_fields['BuyerEmail']['FieldValue'];
        }
    
        /**
         * Set the value of the BuyerEmail property.
         *
         * @param string buyerEmail
         * @return this instance
         */
        public function setBuyerEmail($value)
        {
            $this->_fields['BuyerEmail']['FieldValue'] = $value;
            return $this;
        }
    
        /**
         * Check to see if BuyerEmail is set.
         *
         * @return true if BuyerEmail is set.
         */
        public function isSetBuyerEmail()
        {
            return !is_null($this->_fields['BuyerEmail']['FieldValue']);
        }
    
        /**
         * Set the value of BuyerEmail, return this.
         *
         * @param buyerEmail
         *             The new value to set.
         *
         * @return This instance.
         */
        public function withBuyerEmail($value)
        {
            $this->setBuyerEmail($value);
            return $this;
        }
    
        /**
         * Get the value of the SellerOrderId property.
         *
         * @return String SellerOrderId.
         */
        public function getSellerOrderId()
        {
            return $this->_fields['SellerOrderId']['FieldValue'];
        }
    
        /**
         * Set the value of the SellerOrderId property.
         *
         * @param string sellerOrderId
         * @return this instance
         */
        public function setSellerOrderId($value)
        {
            $this->_fields['SellerOrderId']['FieldValue'] = $value;
            return $this;
        }
    
        /**
         * Check to see if SellerOrderId is set.
         *
         * @return true if SellerOrderId is set.
         */
        public function isSetSellerOrderId()
        {
            return !is_null($this->_fields['SellerOrderId']['FieldValue']);
        }
    
        /**
         * Set the value of SellerOrderId, return this.
         *
         * @param sellerOrderId
         *             The new value to set.
         *
         * @return This instance.
         */
        public function withSellerOrderId($value)
        {
            $this->setSellerOrderId($value);
            return $this;
        }
    
        /**
         * Get the value of the MaxResultsPerPage property.
         *
         * @return Integer MaxResultsPerPage.
         */
        public function getMaxResultsPerPage()
        {
            return $this->_fields['MaxResultsPerPage']['FieldValue'];
        }
    
        /**
         * Set the value of the MaxResultsPerPage property.
         *
         * @param int maxResultsPerPage
         * @return this instance
         */
        public function setMaxResultsPerPage($value)
        {
            $this->_fields['MaxResultsPerPage']['FieldValue'] = $value;
            return $this;
        }
    
        /**
         * Check to see if MaxResultsPerPage is set.
         *
         * @return true if MaxResultsPerPage is set.
         */
        public function isSetMaxResultsPerPage()
        {
            return !is_null($this->_fields['MaxResultsPerPage']['FieldValue']);
        }
    
        /**
         * Set the value of MaxResultsPerPage, return this.
         *
         * @param maxResultsPerPage
         *             The new value to set.
         *
         * @return This instance.
         */
        public function withMaxResultsPerPage($value)
        {
            $this->setMaxResultsPerPage($value);
            return $this;
        }
    
        /**
         * Get the value of the TFMShipmentStatus property.
         *
         * @return List<String> TFMShipmentStatus.
         */
        public function getTFMShipmentStatus()
        {
            if ($this->_fields['TFMShipmentStatus']['FieldValue'] == null) {
                $this->_fields['TFMShipmentStatus']['FieldValue'] = array();
            }
            return $this->_fields['TFMShipmentStatus']['FieldValue'];
        }
    
        /**
         * Set the value of the TFMShipmentStatus property.
         *
         * @param array tfmShipmentStatus
         * @return this instance
         */
        public function setTFMShipmentStatus($value)
        {
            if (!$this->_isNumericArray($value)) {
                $value = array($value);
            }
            $this->_fields['TFMShipmentStatus']['FieldValue'] = $value;
            return $this;
        }
    
        /**
         * Clear TFMShipmentStatus.
         */
        public function unsetTFMShipmentStatus()
        {
            $this->_fields['TFMShipmentStatus']['FieldValue'] = array();
        }
    
        /**
         * Check to see if TFMShipmentStatus is set.
         *
         * @return true if TFMShipmentStatus is set.
         */
        public function isSetTFMShipmentStatus()
        {
            return !empty($this->_fields['TFMShipmentStatus']['FieldValue']);
        }
    
        /**
         * Add values for TFMShipmentStatus, return this.
         *
         * @param tfmShipmentStatus
         *             New values to add.
         *
         * @return This instance.
         */
        public function withTFMShipmentStatus()
        {
            foreach (func_get_args() as $TFMShipmentStatus) {
                $this->_fields['TFMShipmentStatus']['FieldValue'][] = $TFMShipmentStatus;
            }
            return $this;
        }
    
    }

    MWSOrdersPHPClientLibrary-2013-09-01._V533357711_srcMarketplaceWebServiceOrdersSamplesListOrdersSample.php

    <?php
    /*******************************************************************************
     * Copyright 2009-2017 Amazon Services. All Rights Reserved.
     * Licensed under the Apache License, Version 2.0 (the "License");
     *
     * You may not use this file except in compliance with the License.
     * You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
     * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
     * CONDITIONS OF ANY KIND, either express or implied. See the License for the
     * specific language governing permissions and limitations under the License.
     *******************************************************************************
     * PHP Version 5
     * @category Amazon
     * @package  Marketplace Web Service Orders
     * @version  2013-09-01
     * Library Version: 2017-02-22
     * Generated: Thu Mar 02 12:41:08 UTC 2017
     */
    
    /**
     * List Orders Sample
     */
    
    require_once('.config.inc.php');
    
    /************************************************************************
     * Instantiate Implementation of MarketplaceWebServiceOrders
     *
     * AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY constants
     * are defined in the .config.inc.php located in the same
     * directory as this sample
     ***********************************************************************/
    // More endpoints are listed in the MWS Developer Guide
    // North America:
    //$serviceUrl = "https://mws.amazonservices.com/Orders/2013-09-01";
    // Europe
    //$serviceUrl = "https://mws-eu.amazonservices.com/Orders/2013-09-01";
    // Japan
    //$serviceUrl = "https://mws.amazonservices.jp/Orders/2013-09-01";
    // China
    //$serviceUrl = "https://mws.amazonservices.com.cn/Orders/2013-09-01";
    
    
    $config = array(
        'ServiceURL' => $serviceUrl,
        'ProxyHost' => null,
        'ProxyPort' => -1,
        'ProxyUsername' => null,
        'ProxyPassword' => null,
        'MaxErrorRetry' => 3,
    );
    
    $service = new MarketplaceWebServiceOrders_Client(
        AWS_ACCESS_KEY_ID,
        AWS_SECRET_ACCESS_KEY,
        APPLICATION_NAME,
        APPLICATION_VERSION,
        $config);
    
    /************************************************************************
     * Uncomment to try out Mock Service that simulates MarketplaceWebServiceOrders
     * responses without calling MarketplaceWebServiceOrders service.
     *
     * Responses are loaded from local XML files. You can tweak XML files to
     * experiment with various outputs during development
     *
     * XML files available under MarketplaceWebServiceOrders/Mock tree
     *
     ***********************************************************************/
    // $service = new MarketplaceWebServiceOrders_Mock();
    
    /************************************************************************
     * Setup request parameters and uncomment invoke to try out
     * sample for List Orders Action
     ***********************************************************************/
    // @TODO: set request. Action can be passed as MarketplaceWebServiceOrders_Model_ListOrders
    $request = new MarketplaceWebServiceOrders_Model_ListOrdersRequest();
    $request->setSellerId(MERCHANT_ID);
    // object or array of parameters
    invokeListOrders($service, $request);
    
    /**
     * Get List Orders Action Sample
     * Gets competitive pricing and related information for a product identified by
     * the MarketplaceId and ASIN.
     *
     * @param MarketplaceWebServiceOrders_Interface $service instance of MarketplaceWebServiceOrders_Interface
     * @param mixed $request MarketplaceWebServiceOrders_Model_ListOrders or array of parameters
     */
    
    function invokeListOrders(MarketplaceWebServiceOrders_Interface $service, $request)
    {
        try {
            $response = $service->ListOrders($request);
    
            echo("Service Response
    ");
            echo("=============================================================================
    ");
    
            $dom = new DOMDocument();
            $dom->loadXML($response->toXML());
            $dom->preserveWhiteSpace = false;
            $dom->formatOutput = true;
            echo $dom->saveXML();
            echo("ResponseHeaderMetadata: " . $response->getResponseHeaderMetadata() . "
    ");
    
        } catch (MarketplaceWebServiceOrders_Exception $ex) {
            echo("Caught Exception: " . $ex->getMessage() . "
    ");
            echo("Response Status Code: " . $ex->getStatusCode() . "
    ");
            echo("Error Code: " . $ex->getErrorCode() . "
    ");
            echo("Error Type: " . $ex->getErrorType() . "
    ");
            echo("Request ID: " . $ex->getRequestId() . "
    ");
            echo("XML: " . $ex->getXML() . "
    ");
            echo("ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . "
    ");
        }
    }

    MWSOrdersPHPClientLibrary-2013-09-01._V533357711_srcMarketplaceWebServiceOrdersInterface.php

     
    <?php
    
    /*******************************************************************************
     * Copyright 2009-2017 Amazon Services. All Rights Reserved.
     * Licensed under the Apache License, Version 2.0 (the "License");
     *
     * You may not use this file except in compliance with the License.
     * You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
     * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
     * CONDITIONS OF ANY KIND, either express or implied. See the License for the
     * specific language governing permissions and limitations under the License.
     *******************************************************************************
     * PHP Version 5
     * @category Amazon
     * @package  Marketplace Web Service Orders
     * @version  2013-09-01
     * Library Version: 2017-02-22
     * Generated: Thu Mar 02 12:41:08 UTC 2017
     */
    interface  MarketplaceWebServiceOrders_Interface
    {
    
        /**
         * Get Order
         * This operation takes up to 50 order ids and returns the corresponding orders.
         *
         * @param mixed $request array of parameters for MarketplaceWebServiceOrders_Model_GetOrder request or MarketplaceWebServiceOrders_Model_GetOrder object itself
         * @see MarketplaceWebServiceOrders_Model_GetOrderRequest
         * @return MarketplaceWebServiceOrders_Model_GetOrderResponse
         *
         * @throws MarketplaceWebServiceOrders_Exception
         */
        public function getOrder($request);
    
    
        /**
         * Get Service Status
         * Returns the service status of a particular MWS API section. The operation
         *        takes no input.
         *
         * @param mixed $request array of parameters for MarketplaceWebServiceOrders_Model_GetServiceStatus request or MarketplaceWebServiceOrders_Model_GetServiceStatus object itself
         * @see MarketplaceWebServiceOrders_Model_GetServiceStatusRequest
         * @return MarketplaceWebServiceOrders_Model_GetServiceStatusResponse
         *
         * @throws MarketplaceWebServiceOrders_Exception
         */
        public function getServiceStatus($request);
    
    
        /**
         * List Order Items
         * This operation can be used to list the items of the order indicated by the
         *         given order id (only a single Amazon order id is allowed).
         *
         * @param mixed $request array of parameters for MarketplaceWebServiceOrders_Model_ListOrderItems request or MarketplaceWebServiceOrders_Model_ListOrderItems object itself
         * @see MarketplaceWebServiceOrders_Model_ListOrderItemsRequest
         * @return MarketplaceWebServiceOrders_Model_ListOrderItemsResponse
         *
         * @throws MarketplaceWebServiceOrders_Exception
         */
        public function listOrderItems($request);
    
    
        /**
         * List Order Items By Next Token
         * If ListOrderItems cannot return all the order items in one go, it will
         *         provide a nextToken. That nextToken can be used with this operation to
         *         retrive the next batch of items for that order.
         *
         * @param mixed $request array of parameters for MarketplaceWebServiceOrders_Model_ListOrderItemsByNextToken request or MarketplaceWebServiceOrders_Model_ListOrderItemsByNextToken object itself
         * @see MarketplaceWebServiceOrders_Model_ListOrderItemsByNextTokenRequest
         * @return MarketplaceWebServiceOrders_Model_ListOrderItemsByNextTokenResponse
         *
         * @throws MarketplaceWebServiceOrders_Exception
         */
        public function listOrderItemsByNextToken($request);
    
    
        /**
         * List Orders
         * ListOrders can be used to find orders that meet the specified criteria.
         *
         * @param mixed $request array of parameters for MarketplaceWebServiceOrders_Model_ListOrders request or MarketplaceWebServiceOrders_Model_ListOrders object itself
         * @see MarketplaceWebServiceOrders_Model_ListOrdersRequest
         * @return MarketplaceWebServiceOrders_Model_ListOrdersResponse
         *
         * @throws MarketplaceWebServiceOrders_Exception
         */
        public function listOrders($request);
    
    
        /**
         * List Orders By Next Token
         * If ListOrders returns a nextToken, thus indicating that there are more orders
         *         than returned that matched the given filter criteria, ListOrdersByNextToken
         *         can be used to retrieve those other orders using that nextToken.
         *
         * @param mixed $request array of parameters for MarketplaceWebServiceOrders_Model_ListOrdersByNextToken request or MarketplaceWebServiceOrders_Model_ListOrdersByNextToken object itself
         * @see MarketplaceWebServiceOrders_Model_ListOrdersByNextTokenRequest
         * @return MarketplaceWebServiceOrders_Model_ListOrdersByNextTokenResponse
         *
         * @throws MarketplaceWebServiceOrders_Exception
         */
        public function listOrdersByNextToken($request);
    
    }
  • 相关阅读:
    HQL查询.
    Apache solr(二).
    Apache solr(一).
    Node.js入门以及第一个helloworld程序.
    SQL优化一(SQL使用技巧)
    NodeJS安装第一个工程.
    [LeetCode] 545. Boundary of Binary Tree 二叉树的边界
    [LeetCode] 41. First Missing Positive 首个缺失的正数
    [LeetCode] 749. Contain Virus 包含病毒
    [LeetCode] 803. Bricks Falling When Hit 打击砖块掉落
  • 原文地址:https://www.cnblogs.com/rsapaper/p/6674041.html
Copyright © 2020-2023  润新知