amazonservices api 抽象类 Class Abstraction

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

MWSOrdersPHPClientLibrary-2013-09-01._V533357711_\src\MarketplaceWebServiceOrders\Model.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;", "'", "&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_\src\MarketplaceWebServiceOrders\Model\ListOrderRequest.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_\src\MarketplaceWebServiceOrders\Samples\ListOrdersSample.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\n");
        echo("=============================================================================\n");

        $dom = new DOMDocument();
        $dom->loadXML($response->toXML());
        $dom->preserveWhiteSpace = false;
        $dom->formatOutput = true;
        echo $dom->saveXML();
        echo("ResponseHeaderMetadata: " . $response->getResponseHeaderMetadata() . "\n");

    } catch (MarketplaceWebServiceOrders_Exception $ex) {
        echo("Caught Exception: " . $ex->getMessage() . "\n");
        echo("Response Status Code: " . $ex->getStatusCode() . "\n");
        echo("Error Code: " . $ex->getErrorCode() . "\n");
        echo("Error Type: " . $ex->getErrorType() . "\n");
        echo("Request ID: " . $ex->getRequestId() . "\n");
        echo("XML: " . $ex->getXML() . "\n");
        echo("ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . "\n");
    }
}
时间: 2024-10-08 04:25:37

amazonservices api 抽象类 Class Abstraction的相关文章

CEPH OBJECTSTORE API介绍

Thomas是本人在Ceph中国社区翻译小组所用的笔名,该文首次发布在Ceph中国社区,现转载到本人博客,以供大家传阅 CEPH OBJECTSTORE API介绍 本文由 Ceph中国社区-Thomas翻译,陈晓熹校稿 . 英文出处:THE CEPH OBJECTSTORE API 欢迎加入 翻译小组 简介 object store是Ceph OSD的一部分,它完成实际的数据存储.当前有三种不同的object store可用: FileStore: 文件系统+日志后备的存储 KeyValueS

Apache Spark 2.0三种API的传说:RDD、DataFrame和Dataset

Apache Spark吸引广大社区开发者的一个重要原因是:Apache Spark提供极其简单.易用的APIs,支持跨多种语言(比如:Scala.Java.Python和R)来操作大数据. 本文主要讲解Apache Spark 2.0中RDD,DataFrame和Dataset三种API:它们各自适合的使用场景:它们的性能和优化:列举使用DataFrame和DataSet代替RDD的场景.文章大部分聚焦DataFrame和Dataset,因为这是Apache Spark 2.0的API统一的重

iOS开发编程英语(单词带音标)

1 A2A integration [,inti'ɡrei??n] A2A整合 2 abstract ['æbstrækt, æb'strækt] 抽象的 3 abstract base [beis] class (ABC)抽象基类 4 abstract class 抽象类 5 abstraction [æb'stræk??n] 抽象.抽象物.抽象性 6 access ['ækses, 'æks?s, æk'ses]存取.访问 7 access level['lev?l]访问级别 8 acces

软件体系架构课下作业06

题目:对上学期学习的软件设计模式进行复习,对所有设计模式进行分析,用自己的话来阐述对他们的理解.(不少于2000字) 正如本学期所学习的软件体系架构,还有很多其他的软件工程技术一样,设计模式同样起源于建筑领域他是对前人经验的总结,为后人设计与开发基于面向对象的软件提供指导方针和成熟的解决方案. 从模式的目的而言,设计模式可以分为创建型.结构型和行为型三种.创建型模式主要用于创建对象,它包含5种模式,分别是:工厂方法模式.抽象工厂模式.建造者模式.原型模式和单例模式:结构型模式主要用于处理类和对象

常用的I/O流类型

1.I/O流类型基础.(类中方法和子类查看java spring API) 抽象类java.io.InputStream:是所有字节输入流的父类,定义了以字节为基本单位读取数据的基本方法 抽象类java.io.OutputStream:所有字节输出流的类型的父类 抽象类java.io.Reader: 读取输入流类型的父类 抽象类java.io.Writer:写入输出流的父类 2.常用输入/输出的类型(效率不断提高) 2.1 FileInputStream/FileOutputStream jav

PHP开发APP接口(一)

php以json或者xml 形式返回给app.明白这点就很好说了,就是把数据包装成json或者xml,返回给APP 定义抽象APP基类: <?php /** * 定义API抽象类 */ abstract class Api { const JSON = 'Json'; const XML = 'Xml'; const ARR = 'Array'; /** * 定义工厂方法 * param string $type 返回数据类型 */ public static function factory(

Number Integer Random 数值类

基本数据类型对象包装类 基本数据类型对象包装类 byte        Byte short       Short int           Integer long        Long float        Float double    Double char         Character boolean  Boolean 自动装箱和拆箱 Integer i = 4; //自动装箱,会自动转换为以下形式:Integer i = new Integer(4); i += 6;

Ogre参考手册(一)2 核心对象

说明 翻译自Ogre 1.81 manual,在不影响理解的情况下做了删减,以减小阅读的时间和翻译的工作量 这么做只是去掉了文字上修饰部分,并没有减少任何原文档中的知识点,可以作为对等的参考手册 另外对一些不易理解的部分做了修改,或通过“附”做了标注 如果你发现了不易理解的部分,可以跟帖回复,我会原文做修改或回复 Ogre参考手册前两章为为基本介绍,比较精简 最核心的内容是第三章,特别是3.1节 依次则是第七章和第五章,都值得花时间从头到尾读一遍 1 介绍 略… 2 核心对象 下图是Ogre的主

Building Web Apps with SignalR, Part 1

Building Web Apps with SignalR, Part 1 In the first installment of app-building with SignalR, learn how to build a real-time chat application. By Eric Vogel 01/22/2013 GET CODE DOWNLOAD More on this topic: Building a Chat Web App with Signal R, Part