<?php
/*******************************************************************************
 * Copyright 2009-2014 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 Products
 * @version  2011-10-01
 * Library Version: 2014-10-20
 * Generated: Fri Oct 17 17:59:56 GMT 2014
 */

/**
 * MarketplaceWebServiceProducts_Model_GetMyPriceForASINResponse
 *
 * Properties:
 *

 *
 *
GetMyPriceForASINResult: array

 *
ResponseMetadata: MarketplaceWebServiceProducts_Model_ResponseMetadata

 *
ResponseHeaderMetadata: MarketplaceWebServiceProducts_Model_ResponseHeaderMetadata

 *
 *

 */
class MarketplaceWebServiceProducts_Model_GetMyPriceForASINResponse extends MarketplaceWebServiceProducts_Model
{

    public function __construct($data = null)
    {
        $this->_fields = array(
            'GetMyPriceForASINResult' => array(
                'FieldValue' => array(),
                'FieldType' => array('MarketplaceWebServiceProducts_Model_GetMyPriceForASINResult')
            ),
            'ResponseMetadata' => array(
                'FieldValue' => null,
                'FieldType' => 'MarketplaceWebServiceProducts_Model_ResponseMetadata'
            ),
            'ResponseHeaderMetadata' => array(
                'FieldValue' => null,
                'FieldType' => 'MarketplaceWebServiceProducts_Model_ResponseHeaderMetadata'
            ),
        );
        parent::__construct($data);
    }

    /**
     * Get the value of the GetMyPriceForASINResult property.
     *
     * @return MarketplaceWebServiceProducts_Model_GetMyPriceForASINResult[] GetMyPriceForASINResult.
     */
    public function getGetMyPriceForASINResult()
    {
        if ($this->_fields['GetMyPriceForASINResult']['FieldValue'] == null) {
            $this->_fields['GetMyPriceForASINResult']['FieldValue'] = array();
        }
        return $this->_fields['GetMyPriceForASINResult']['FieldValue'];
    }

    /**
     * Set the value of the GetMyPriceForASINResult property.
     *
     * @param array $value getMyPriceForASINResult
     * @return $this This instance
     */
    public function setGetMyPriceForASINResult($value)
    {
        if (!$this->_isNumericArray($value)) {
            $value = array($value);
        }
        $this->_fields['GetMyPriceForASINResult']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Clear GetMyPriceForASINResult.
     */
    public function unsetGetMyPriceForASINResult()
    {
        $this->_fields['GetMyPriceForASINResult']['FieldValue'] = array();
    }

    /**
     * Check to see if GetMyPriceForASINResult is set.
     *
     * @return true if GetMyPriceForASINResult is set.
     */
    public function isSetGetMyPriceForASINResult()
    {
        return !empty($this->_fields['GetMyPriceForASINResult']['FieldValue']);
    }

    /**
     * Add values for GetMyPriceForASINResult, return this.
     *
     * @param getMyPriceForASINResult
     *             New values to add.
     *
     * @return $this This instance.
     */
    public function withGetMyPriceForASINResult()
    {
        foreach (func_get_args() as $GetMyPriceForASINResult) {
            $this->_fields['GetMyPriceForASINResult']['FieldValue'][] = $GetMyPriceForASINResult;
        }
        return $this;
    }

    /**
     * Get the value of the ResponseMetadata property.
     *
     * @return MarketplaceWebServiceProducts_Model_ResponseMetadata ResponseMetadata.
     */
    public function getResponseMetadata()
    {
        return $this->_fields['ResponseMetadata']['FieldValue'];
    }

    /**
     * Set the value of the ResponseMetadata property.
     *
     * @param MarketplaceWebServiceProducts_Model_ResponseMetadata $value responseMetadata
     * @return $this This instance
     */
    public function setResponseMetadata($value)
    {
        $this->_fields['ResponseMetadata']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Check to see if ResponseMetadata is set.
     *
     * @return true if ResponseMetadata is set.
     */
    public function isSetResponseMetadata()
    {
        return !is_null($this->_fields['ResponseMetadata']['FieldValue']);
    }

    /**
     * Set the value of ResponseMetadata, return this.
     *
     * @param responseMetadata
     *             The new value to set.
     *
     * @return $this This instance.
     */
    public function withResponseMetadata($value)
    {
        $this->setResponseMetadata($value);
        return $this;
    }

    /**
     * Get the value of the ResponseHeaderMetadata property.
     *
     * @return MarketplaceWebServiceProducts_Model_ResponseHeaderMetadata ResponseHeaderMetadata.
     */
    public function getResponseHeaderMetadata()
    {
        return $this->_fields['ResponseHeaderMetadata']['FieldValue'];
    }

    /**
     * Set the value of the ResponseHeaderMetadata property.
     *
     * @param MarketplaceWebServiceProducts_Model_ResponseHeaderMetadata $value responseHeaderMetadata
     * @return $this This instance
     */
    public function setResponseHeaderMetadata($value)
    {
        $this->_fields['ResponseHeaderMetadata']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Check to see if ResponseHeaderMetadata is set.
     *
     * @return true if ResponseHeaderMetadata is set.
     */
    public function isSetResponseHeaderMetadata()
    {
        return !is_null($this->_fields['ResponseHeaderMetadata']['FieldValue']);
    }

    /**
     * Set the value of ResponseHeaderMetadata, return this.
     *
     * @param responseHeaderMetadata
     *             The new value to set.
     *
     * @return $this This instance.
     */
    public function withResponseHeaderMetadata($value)
    {
        $this->setResponseHeaderMetadata($value);
        return $this;
    }

    /**
     * Construct MarketplaceWebServiceProducts_Model_GetMyPriceForASINResponse from XML string
     *
     * @param $xml
     *        XML string to construct from
     * @return MarketplaceWebServiceProducts_Model_GetMyPriceForASINResponse
     * @throws Exception
     */
    public static function fromXML($xml)
    {
        $dom = new DOMDocument();
        $dom->loadXML($xml);
        $xpath = new DOMXPath($dom);
        $response = $xpath->query("//*[local-name()='GetMyPriceForASINResponse']");
        if ($response->length == 1) {
            return new MarketplaceWebServiceProducts_Model_GetMyPriceForASINResponse(($response->item(0)));
        } else {
            throw new Exception ("Unable to construct MarketplaceWebServiceProducts_Model_GetMyPriceForASINResponse from provided XML.
                                  Make sure that GetMyPriceForASINResponse is a root element");
        }
    }

    /**
     * XML Representation for this object
     *
     * @return string XML for this object
     */
    public function toXML()
    {
        $xml = "";
        $xml .= "<GetMyPriceForASINResponse xmlns=\"http://mws.amazonservices.com/schema/Products/2011-10-01\">";
        $xml .= $this->_toXMLFragment();
        $xml .= "</GetMyPriceForASINResponse>";
        return $xml;
    }

}


<?php
/*******************************************************************************
 * Copyright 2009-2014 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  FBA Inventory Service MWS
 * @version  2010-10-01
 * Library Version: 2014-10-20
 * Generated: Fri Oct 17 17:54:00 GMT 2014
 */

/**
 * FBAInventoryServiceMWS_Model_InventorySupplyDetailList
 *
 * Properties:
 *

 *
 *
member: array

 *
 *

 */
class FBAInventoryServiceMWS_Model_InventorySupplyDetailList extends FBAInventoryServiceMWS_Model
{

    public function __construct($data = null)
    {
        $this->_fields = array(
            'member' => array(
                'FieldValue' => array(),
                'FieldType' => array('FBAInventoryServiceMWS_Model_InventorySupplyDetail')
            ),
        );
        parent::__construct($data);
    }

    /**
     * Get the value of the member property.
     *
     * @return FBAInventoryServiceMWS_Model_InventorySupplyDetail[] member.
     */
    public function getmember()
    {
        if ($this->_fields['member']['FieldValue'] == null) {
            $this->_fields['member']['FieldValue'] = array();
        }
        return $this->_fields['member']['FieldValue'];
    }

    /**
     * Set the value of the member property.
     *
     * @param array $value
     * @return $this This instance
     */
    public function setmember($value)
    {
        if (!$this->_isNumericArray($value)) {
            $value = array($value);
        }
        $this->_fields['member']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Clear member.
     */
    public function unsetmember()
    {
        $this->_fields['member']['FieldValue'] = array();
    }

    /**
     * Check to see if member is set.
     *
     * @return true if member is set.
     */
    public function isSetmember()
    {
        return !empty($this->_fields['member']['FieldValue']);
    }

    /**
     * Add values for member, return this.
     *
     * @param member
     *             New values to add.
     *
     * @return $this This instance.
     */
    public function withmember()
    {
        foreach (func_get_args() as $member) {
            $this->_fields['member']['FieldValue'][] = $member;
        }
        return $this;
    }

}


<?php

namespace Circlical\PoEditor;

/**
 * Class Block
 * @package Circlical\PoEditor
 *
 * This class defines a "part" of a PO file, inclusive of comments, plurals, ids, etc.  A formatting guide can be
 * found here https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html
 */
class Block
{

	const NEWLINE = "\n";

	public $msgid = [];

	public $msgid_plural = [];

	public $msgstr = [];

	public $msgstr_plural = [];

	public $msgctxt = null;

	public $comments = [];

	private $last_processed;

	/**
	 * @var bool
	 */
	protected $initialized = false;

	public function process($s)
	{
		$this->is_initialized = true;

		$s = trim($s);

		// headers are first in the po file, set externally
		if ($s[0] == '"') {
			if ($this->last_processed)
				$this->processLine($this->last_processed, $s);
		} // comments are noted by #
		else if ($s[0] == '#') {
			$this->comments[] = $s;
		} // otherwise, process the string within the block
		else {
			list($car, $cdr) = explode(' ', $s, 2);
			$this->processLine($car, $cdr);
		}
	}

	public function processLine($car, $cdr)
	{
		// remove at most one double-quote from a string
		$clean_string = preg_replace('/^("(.*)")$/', '$2$3', $cdr);

		if (preg_match("/^msgstr\\[(\\d)\\]$/us", $car, $matches)) {
			$this->msgstr_plural[$matches[1]][] = $clean_string;
		} else {
			switch ($car) {
				case 'msgctxt':
					$this->msgctxt = $clean_string;
					break;
				case 'msgid':
				case 'msgstr':
				case 'msgid_plural':
					array_push($this->$car, $clean_string);
					break;
			}
		}
		$this->last_processed = $car;
	}

	/**
	 * Take all the parsed block parts and flatten them into a gettext-ready string; the part in the PO file
	 * that this block represents.
	 *
	 * @return string
	 */
	public function compile()
	{
		// can happen if it parses only comments/artifacts
		if (!count($this->msgid))
			return "";

		$str = "";
		if ($this->comments)
			$str .= implode(self::NEWLINE, $this->comments) . self::NEWLINE;

		if ($this->msgctxt)
			$str .= 'msgctxt "' . $this->msgctxt . '"' . self::NEWLINE;

		$included_blocks = ['msgid'];
		if ($this->msgstr_plural)
			$included_blocks[] = 'msgid_plural';
		else
			$included_blocks[] = 'msgstr';

		foreach ($included_blocks as $key) {
			if (is_array($this->$key)) {
				$str .= "$key ";
				$str .= implode(self::NEWLINE, array_map([$this, 'quoteWrap'], $this->$key)) . self::NEWLINE;
			}
		}

		if ($this->msgid_plural && $this->msgstr_plural) {
			foreach ($this->msgstr_plural as $plural_key => $plural_message) {
				$str .= 'msgstr[' . $plural_key . '] ';
				$str .= implode(self::NEWLINE, array_map([$this, 'quoteWrap'], $plural_message)) . self::NEWLINE;
			}
		}

		return trim($str);
	}

	private function quoteWrap($str)
	{
		return '"' . $str . '"';
	}

	/**
	 * @return array
	 */
	public function getMsgid()
	{
		return $this->msgid;
	}

	/**
	 * @param array $msgid
	 */
	public function setMsgid($msgid)
	{
		if (!is_array($msgid))
			$msgid = [$msgid];

		$this->msgid = $msgid;
	}

	/**
	 * @return array
	 */
	public function getMsgidPlural()
	{
		return $this->msgid_plural;
	}

	/**
	 * @param array $msgid_plural
	 */
	public function setMsgidPlural($msgid_plural)
	{
		if (!is_array($msgid_plural))
			$msgid_plural = [$msgid_plural];

		$this->msgid_plural = $msgid_plural;
	}

	/**
	 * @return array
	 */
	public function getMsgstr()
	{
		return $this->msgstr;
	}

	/**
	 * @param array $msgstr
	 */
	public function setMsgstr($msgstr)
	{
		if (!is_array($msgstr))
			$msgstr = [$msgstr];

		$this->msgstr = $msgstr;
	}

	/**
	 * @return mixed
	 */
	public function getMsgctxt()
	{
		return $this->msgctxt;
	}

	/**
	 * @param mixed $msgctxt
	 */
	public function setMsgctxt($msgctxt)
	{
		$this->msgctxt = $msgctxt;
	}

	/**
	 * @return array
	 */
	public function getMsgstrPlural()
	{
		return $this->msgstr_plural;
	}

	/**
	 * @param array $msgstr_plural
	 */
	public function setMsgstrPlural($msgstr_plural)
	{
		$this->msgstr_plural = $msgstr_plural;
	}

	/**
	 * @return array
	 */
	public function getPluralForm($key)
	{
		return $this->msgstr_plural[$key] ?: "";
	}

	/**
	 * Sets a particular plural message key
	 * @param int $key The plural form being set
	 * @param string|array $plural The plural string
	 */
	public function setPluralForm($key, $plural)
	{
		if (!is_array($plural))
			$plural = [$plural];

		if (!$this->msgstr_plural)
			$this->msgstr_plural = [];

		$this->msgstr_plural[$key] = $plural;
	}

	/**
	 * @return array
	 */
	public function getComments()
	{
		return $this->comments;
	}

	/**
	 * @param array $comment
	 */
	public function setComments($comment)
	{
		if (!is_array($comment))
			$comment = [$comment];

		$this->comments = $comment;
	}

	/**
	 * @return boolean
	 */
	public function isInitialized()
	{
		return $this->initialized;
	}

	/**
	 * @param boolean $initialized
	 */
	public function setInitialized($initialized)
	{
		$this->initialized = $initialized;
	}

	/**
	 * Return a compiled key that is a function of context (msgctxt) and id (msgid)
	 * @return string
	 */
	public function getKey()
	{
		return json_encode(['context' => $this->msgctxt, 'id' => implode("", $this->getMsgid())]);
	}

}


<?php
/*******************************************************************************
 * Copyright 2009-2015 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  MWS Finances Service
 * @version  2015-05-01
 * Library Version: 2015-09-03
 * Generated: Thu Sep 03 17:55:25 GMT 2015
 */

/**
 *  @see MWSFinancesService_Model
 */

require_once (dirname(__FILE__) . '/../Model.php');

/**
 * MWSFinancesService_Model_FinancialEvents
 *
 * Properties:
 *

 *
 *
ShipmentEventList: array

 *
RefundEventList: array

 *
GuaranteeClaimEventList: array

 *
ChargebackEventList: array

 *
PayWithAmazonEventList: array

 *
ServiceProviderCreditEventList: array

 *
RetrochargeEventList: array

 *
RentalTransactionEventList: array

 *
PerformanceBondRefundEventList: array

 *
ServiceFeeEventList: array

 *
DebtRecoveryEventList: array

 *
LoanServicingEventList: array

 *
AdjustmentEventList: array

 *
 *

 */

 class MWSFinancesService_Model_FinancialEvents extends MWSFinancesService_Model {

    public function __construct($data = null)
    {
    $this->_fields = array (
    'ShipmentEventList' => array('FieldValue' => array(), 'FieldType' => array('MWSFinancesService_Model_ShipmentEvent'), 'ListMemberName' => 'ShipmentEvent'),
    'RefundEventList' => array('FieldValue' => array(), 'FieldType' => array('MWSFinancesService_Model_ShipmentEvent'), 'ListMemberName' => 'ShipmentEvent'),
    'GuaranteeClaimEventList' => array('FieldValue' => array(), 'FieldType' => array('MWSFinancesService_Model_ShipmentEvent'), 'ListMemberName' => 'ShipmentEvent'),
    'ChargebackEventList' => array('FieldValue' => array(), 'FieldType' => array('MWSFinancesService_Model_ShipmentEvent'), 'ListMemberName' => 'ShipmentEvent'),
    'PayWithAmazonEventList' => array('FieldValue' => array(), 'FieldType' => array('MWSFinancesService_Model_PayWithAmazonEvent'), 'ListMemberName' => 'PayWithAmazonEvent'),
    'ServiceProviderCreditEventList' => array('FieldValue' => array(), 'FieldType' => array('MWSFinancesService_Model_SolutionProviderCreditEvent'), 'ListMemberName' => 'SolutionProviderCreditEvent'),
    'RetrochargeEventList' => array('FieldValue' => array(), 'FieldType' => array('MWSFinancesService_Model_RetrochargeEvent'), 'ListMemberName' => 'RetrochargeEvent'),
    'RentalTransactionEventList' => array('FieldValue' => array(), 'FieldType' => array('MWSFinancesService_Model_RentalTransactionEvent'), 'ListMemberName' => 'RentalTransactionEvent'),
    'PerformanceBondRefundEventList' => array('FieldValue' => array(), 'FieldType' => array('MWSFinancesService_Model_PerformanceBondRefundEvent'), 'ListMemberName' => 'PerformanceBondRefundEvent'),
    'ServiceFeeEventList' => array('FieldValue' => array(), 'FieldType' => array('MWSFinancesService_Model_ServiceFeeEvent'), 'ListMemberName' => 'ServiceFeeEvent'),
    'DebtRecoveryEventList' => array('FieldValue' => array(), 'FieldType' => array('MWSFinancesService_Model_DebtRecoveryEvent'), 'ListMemberName' => 'DebtRecoveryEvent'),
    'LoanServicingEventList' => array('FieldValue' => array(), 'FieldType' => array('MWSFinancesService_Model_LoanServicingEvent'), 'ListMemberName' => 'LoanServicingEvent'),
    'AdjustmentEventList' => array('FieldValue' => array(), 'FieldType' => array('MWSFinancesService_Model_AdjustmentEvent'), 'ListMemberName' => 'AdjustmentEvent'),
    );
    parent::__construct($data);
    }

    /**
     * Get the value of the ShipmentEventList property.
     *
     * @return List<ShipmentEvent> ShipmentEventList.
     */
    public function getShipmentEventList()
    {
        if ($this->_fields['ShipmentEventList']['FieldValue'] == null)
        {
            $this->_fields['ShipmentEventList']['FieldValue'] = array();
        }
        return $this->_fields['ShipmentEventList']['FieldValue'];
    }

    /**
     * Set the value of the ShipmentEventList property.
     *
     * @param array shipmentEventList
     * @return this instance
     */
    public function setShipmentEventList($value)
    {
        if (!$this->_isNumericArray($value)) {
            $value = array ($value);
        }
        $this->_fields['ShipmentEventList']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Clear ShipmentEventList.
     */
    public function unsetShipmentEventList()
    {
        $this->_fields['ShipmentEventList']['FieldValue'] = array();
    }

    /**
     * Check to see if ShipmentEventList is set.
     *
     * @return true if ShipmentEventList is set.
     */
    public function isSetShipmentEventList()
    {
                return !empty($this->_fields['ShipmentEventList']['FieldValue']);
            }

    /**
     * Add values for ShipmentEventList, return this.
     *
     * @param shipmentEventList
     *             New values to add.
     *
     * @return This instance.
     */
    public function withShipmentEventList()
    {
        foreach (func_get_args() as $ShipmentEventList)
        {
            $this->_fields['ShipmentEventList']['FieldValue'][] = $ShipmentEventList;
        }
        return $this;
    }

    /**
     * Get the value of the RefundEventList property.
     *
     * @return List<ShipmentEvent> RefundEventList.
     */
    public function getRefundEventList()
    {
        if ($this->_fields['RefundEventList']['FieldValue'] == null)
        {
            $this->_fields['RefundEventList']['FieldValue'] = array();
        }
        return $this->_fields['RefundEventList']['FieldValue'];
    }

    /**
     * Set the value of the RefundEventList property.
     *
     * @param array refundEventList
     * @return this instance
     */
    public function setRefundEventList($value)
    {
        if (!$this->_isNumericArray($value)) {
            $value = array ($value);
        }
        $this->_fields['RefundEventList']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Clear RefundEventList.
     */
    public function unsetRefundEventList()
    {
        $this->_fields['RefundEventList']['FieldValue'] = array();
    }

    /**
     * Check to see if RefundEventList is set.
     *
     * @return true if RefundEventList is set.
     */
    public function isSetRefundEventList()
    {
                return !empty($this->_fields['RefundEventList']['FieldValue']);
            }

    /**
     * Add values for RefundEventList, return this.
     *
     * @param refundEventList
     *             New values to add.
     *
     * @return This instance.
     */
    public function withRefundEventList()
    {
        foreach (func_get_args() as $RefundEventList)
        {
            $this->_fields['RefundEventList']['FieldValue'][] = $RefundEventList;
        }
        return $this;
    }

    /**
     * Get the value of the GuaranteeClaimEventList property.
     *
     * @return List<ShipmentEvent> GuaranteeClaimEventList.
     */
    public function getGuaranteeClaimEventList()
    {
        if ($this->_fields['GuaranteeClaimEventList']['FieldValue'] == null)
        {
            $this->_fields['GuaranteeClaimEventList']['FieldValue'] = array();
        }
        return $this->_fields['GuaranteeClaimEventList']['FieldValue'];
    }

    /**
     * Set the value of the GuaranteeClaimEventList property.
     *
     * @param array guaranteeClaimEventList
     * @return this instance
     */
    public function setGuaranteeClaimEventList($value)
    {
        if (!$this->_isNumericArray($value)) {
            $value = array ($value);
        }
        $this->_fields['GuaranteeClaimEventList']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Clear GuaranteeClaimEventList.
     */
    public function unsetGuaranteeClaimEventList()
    {
        $this->_fields['GuaranteeClaimEventList']['FieldValue'] = array();
    }

    /**
     * Check to see if GuaranteeClaimEventList is set.
     *
     * @return true if GuaranteeClaimEventList is set.
     */
    public function isSetGuaranteeClaimEventList()
    {
                return !empty($this->_fields['GuaranteeClaimEventList']['FieldValue']);
            }

    /**
     * Add values for GuaranteeClaimEventList, return this.
     *
     * @param guaranteeClaimEventList
     *             New values to add.
     *
     * @return This instance.
     */
    public function withGuaranteeClaimEventList()
    {
        foreach (func_get_args() as $GuaranteeClaimEventList)
        {
            $this->_fields['GuaranteeClaimEventList']['FieldValue'][] = $GuaranteeClaimEventList;
        }
        return $this;
    }

    /**
     * Get the value of the ChargebackEventList property.
     *
     * @return List<ShipmentEvent> ChargebackEventList.
     */
    public function getChargebackEventList()
    {
        if ($this->_fields['ChargebackEventList']['FieldValue'] == null)
        {
            $this->_fields['ChargebackEventList']['FieldValue'] = array();
        }
        return $this->_fields['ChargebackEventList']['FieldValue'];
    }

    /**
     * Set the value of the ChargebackEventList property.
     *
     * @param array chargebackEventList
     * @return this instance
     */
    public function setChargebackEventList($value)
    {
        if (!$this->_isNumericArray($value)) {
            $value = array ($value);
        }
        $this->_fields['ChargebackEventList']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Clear ChargebackEventList.
     */
    public function unsetChargebackEventList()
    {
        $this->_fields['ChargebackEventList']['FieldValue'] = array();
    }

    /**
     * Check to see if ChargebackEventList is set.
     *
     * @return true if ChargebackEventList is set.
     */
    public function isSetChargebackEventList()
    {
                return !empty($this->_fields['ChargebackEventList']['FieldValue']);
            }

    /**
     * Add values for ChargebackEventList, return this.
     *
     * @param chargebackEventList
     *             New values to add.
     *
     * @return This instance.
     */
    public function withChargebackEventList()
    {
        foreach (func_get_args() as $ChargebackEventList)
        {
            $this->_fields['ChargebackEventList']['FieldValue'][] = $ChargebackEventList;
        }
        return $this;
    }

    /**
     * Get the value of the PayWithAmazonEventList property.
     *
     * @return List<PayWithAmazonEvent> PayWithAmazonEventList.
     */
    public function getPayWithAmazonEventList()
    {
        if ($this->_fields['PayWithAmazonEventList']['FieldValue'] == null)
        {
            $this->_fields['PayWithAmazonEventList']['FieldValue'] = array();
        }
        return $this->_fields['PayWithAmazonEventList']['FieldValue'];
    }

    /**
     * Set the value of the PayWithAmazonEventList property.
     *
     * @param array payWithAmazonEventList
     * @return this instance
     */
    public function setPayWithAmazonEventList($value)
    {
        if (!$this->_isNumericArray($value)) {
            $value = array ($value);
        }
        $this->_fields['PayWithAmazonEventList']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Clear PayWithAmazonEventList.
     */
    public function unsetPayWithAmazonEventList()
    {
        $this->_fields['PayWithAmazonEventList']['FieldValue'] = array();
    }

    /**
     * Check to see if PayWithAmazonEventList is set.
     *
     * @return true if PayWithAmazonEventList is set.
     */
    public function isSetPayWithAmazonEventList()
    {
                return !empty($this->_fields['PayWithAmazonEventList']['FieldValue']);
            }

    /**
     * Add values for PayWithAmazonEventList, return this.
     *
     * @param payWithAmazonEventList
     *             New values to add.
     *
     * @return This instance.
     */
    public function withPayWithAmazonEventList()
    {
        foreach (func_get_args() as $PayWithAmazonEventList)
        {
            $this->_fields['PayWithAmazonEventList']['FieldValue'][] = $PayWithAmazonEventList;
        }
        return $this;
    }

    /**
     * Get the value of the ServiceProviderCreditEventList property.
     *
     * @return List<SolutionProviderCreditEvent> ServiceProviderCreditEventList.
     */
    public function getServiceProviderCreditEventList()
    {
        if ($this->_fields['ServiceProviderCreditEventList']['FieldValue'] == null)
        {
            $this->_fields['ServiceProviderCreditEventList']['FieldValue'] = array();
        }
        return $this->_fields['ServiceProviderCreditEventList']['FieldValue'];
    }

    /**
     * Set the value of the ServiceProviderCreditEventList property.
     *
     * @param array serviceProviderCreditEventList
     * @return this instance
     */
    public function setServiceProviderCreditEventList($value)
    {
        if (!$this->_isNumericArray($value)) {
            $value = array ($value);
        }
        $this->_fields['ServiceProviderCreditEventList']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Clear ServiceProviderCreditEventList.
     */
    public function unsetServiceProviderCreditEventList()
    {
        $this->_fields['ServiceProviderCreditEventList']['FieldValue'] = array();
    }

    /**
     * Check to see if ServiceProviderCreditEventList is set.
     *
     * @return true if ServiceProviderCreditEventList is set.
     */
    public function isSetServiceProviderCreditEventList()
    {
                return !empty($this->_fields['ServiceProviderCreditEventList']['FieldValue']);
            }

    /**
     * Add values for ServiceProviderCreditEventList, return this.
     *
     * @param serviceProviderCreditEventList
     *             New values to add.
     *
     * @return This instance.
     */
    public function withServiceProviderCreditEventList()
    {
        foreach (func_get_args() as $ServiceProviderCreditEventList)
        {
            $this->_fields['ServiceProviderCreditEventList']['FieldValue'][] = $ServiceProviderCreditEventList;
        }
        return $this;
    }

    /**
     * Get the value of the RetrochargeEventList property.
     *
     * @return List<RetrochargeEvent> RetrochargeEventList.
     */
    public function getRetrochargeEventList()
    {
        if ($this->_fields['RetrochargeEventList']['FieldValue'] == null)
        {
            $this->_fields['RetrochargeEventList']['FieldValue'] = array();
        }
        return $this->_fields['RetrochargeEventList']['FieldValue'];
    }

    /**
     * Set the value of the RetrochargeEventList property.
     *
     * @param array retrochargeEventList
     * @return this instance
     */
    public function setRetrochargeEventList($value)
    {
        if (!$this->_isNumericArray($value)) {
            $value = array ($value);
        }
        $this->_fields['RetrochargeEventList']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Clear RetrochargeEventList.
     */
    public function unsetRetrochargeEventList()
    {
        $this->_fields['RetrochargeEventList']['FieldValue'] = array();
    }

    /**
     * Check to see if RetrochargeEventList is set.
     *
     * @return true if RetrochargeEventList is set.
     */
    public function isSetRetrochargeEventList()
    {
                return !empty($this->_fields['RetrochargeEventList']['FieldValue']);
            }

    /**
     * Add values for RetrochargeEventList, return this.
     *
     * @param retrochargeEventList
     *             New values to add.
     *
     * @return This instance.
     */
    public function withRetrochargeEventList()
    {
        foreach (func_get_args() as $RetrochargeEventList)
        {
            $this->_fields['RetrochargeEventList']['FieldValue'][] = $RetrochargeEventList;
        }
        return $this;
    }

    /**
     * Get the value of the RentalTransactionEventList property.
     *
     * @return List<RentalTransactionEvent> RentalTransactionEventList.
     */
    public function getRentalTransactionEventList()
    {
        if ($this->_fields['RentalTransactionEventList']['FieldValue'] == null)
        {
            $this->_fields['RentalTransactionEventList']['FieldValue'] = array();
        }
        return $this->_fields['RentalTransactionEventList']['FieldValue'];
    }

    /**
     * Set the value of the RentalTransactionEventList property.
     *
     * @param array rentalTransactionEventList
     * @return this instance
     */
    public function setRentalTransactionEventList($value)
    {
        if (!$this->_isNumericArray($value)) {
            $value = array ($value);
        }
        $this->_fields['RentalTransactionEventList']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Clear RentalTransactionEventList.
     */
    public function unsetRentalTransactionEventList()
    {
        $this->_fields['RentalTransactionEventList']['FieldValue'] = array();
    }

    /**
     * Check to see if RentalTransactionEventList is set.
     *
     * @return true if RentalTransactionEventList is set.
     */
    public function isSetRentalTransactionEventList()
    {
                return !empty($this->_fields['RentalTransactionEventList']['FieldValue']);
            }

    /**
     * Add values for RentalTransactionEventList, return this.
     *
     * @param rentalTransactionEventList
     *             New values to add.
     *
     * @return This instance.
     */
    public function withRentalTransactionEventList()
    {
        foreach (func_get_args() as $RentalTransactionEventList)
        {
            $this->_fields['RentalTransactionEventList']['FieldValue'][] = $RentalTransactionEventList;
        }
        return $this;
    }

    /**
     * Get the value of the PerformanceBondRefundEventList property.
     *
     * @return List<PerformanceBondRefundEvent> PerformanceBondRefundEventList.
     */
    public function getPerformanceBondRefundEventList()
    {
        if ($this->_fields['PerformanceBondRefundEventList']['FieldValue'] == null)
        {
            $this->_fields['PerformanceBondRefundEventList']['FieldValue'] = array();
        }
        return $this->_fields['PerformanceBondRefundEventList']['FieldValue'];
    }

    /**
     * Set the value of the PerformanceBondRefundEventList property.
     *
     * @param array performanceBondRefundEventList
     * @return this instance
     */
    public function setPerformanceBondRefundEventList($value)
    {
        if (!$this->_isNumericArray($value)) {
            $value = array ($value);
        }
        $this->_fields['PerformanceBondRefundEventList']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Clear PerformanceBondRefundEventList.
     */
    public function unsetPerformanceBondRefundEventList()
    {
        $this->_fields['PerformanceBondRefundEventList']['FieldValue'] = array();
    }

    /**
     * Check to see if PerformanceBondRefundEventList is set.
     *
     * @return true if PerformanceBondRefundEventList is set.
     */
    public function isSetPerformanceBondRefundEventList()
    {
                return !empty($this->_fields['PerformanceBondRefundEventList']['FieldValue']);
            }

    /**
     * Add values for PerformanceBondRefundEventList, return this.
     *
     * @param performanceBondRefundEventList
     *             New values to add.
     *
     * @return This instance.
     */
    public function withPerformanceBondRefundEventList()
    {
        foreach (func_get_args() as $PerformanceBondRefundEventList)
        {
            $this->_fields['PerformanceBondRefundEventList']['FieldValue'][] = $PerformanceBondRefundEventList;
        }
        return $this;
    }

    /**
     * Get the value of the ServiceFeeEventList property.
     *
     * @return List<ServiceFeeEvent> ServiceFeeEventList.
     */
    public function getServiceFeeEventList()
    {
        if ($this->_fields['ServiceFeeEventList']['FieldValue'] == null)
        {
            $this->_fields['ServiceFeeEventList']['FieldValue'] = array();
        }
        return $this->_fields['ServiceFeeEventList']['FieldValue'];
    }

    /**
     * Set the value of the ServiceFeeEventList property.
     *
     * @param array serviceFeeEventList
     * @return this instance
     */
    public function setServiceFeeEventList($value)
    {
        if (!$this->_isNumericArray($value)) {
            $value = array ($value);
        }
        $this->_fields['ServiceFeeEventList']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Clear ServiceFeeEventList.
     */
    public function unsetServiceFeeEventList()
    {
        $this->_fields['ServiceFeeEventList']['FieldValue'] = array();
    }

    /**
     * Check to see if ServiceFeeEventList is set.
     *
     * @return true if ServiceFeeEventList is set.
     */
    public function isSetServiceFeeEventList()
    {
                return !empty($this->_fields['ServiceFeeEventList']['FieldValue']);
            }

    /**
     * Add values for ServiceFeeEventList, return this.
     *
     * @param serviceFeeEventList
     *             New values to add.
     *
     * @return This instance.
     */
    public function withServiceFeeEventList()
    {
        foreach (func_get_args() as $ServiceFeeEventList)
        {
            $this->_fields['ServiceFeeEventList']['FieldValue'][] = $ServiceFeeEventList;
        }
        return $this;
    }

    /**
     * Get the value of the DebtRecoveryEventList property.
     *
     * @return List<DebtRecoveryEvent> DebtRecoveryEventList.
     */
    public function getDebtRecoveryEventList()
    {
        if ($this->_fields['DebtRecoveryEventList']['FieldValue'] == null)
        {
            $this->_fields['DebtRecoveryEventList']['FieldValue'] = array();
        }
        return $this->_fields['DebtRecoveryEventList']['FieldValue'];
    }

    /**
     * Set the value of the DebtRecoveryEventList property.
     *
     * @param array debtRecoveryEventList
     * @return this instance
     */
    public function setDebtRecoveryEventList($value)
    {
        if (!$this->_isNumericArray($value)) {
            $value = array ($value);
        }
        $this->_fields['DebtRecoveryEventList']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Clear DebtRecoveryEventList.
     */
    public function unsetDebtRecoveryEventList()
    {
        $this->_fields['DebtRecoveryEventList']['FieldValue'] = array();
    }

    /**
     * Check to see if DebtRecoveryEventList is set.
     *
     * @return true if DebtRecoveryEventList is set.
     */
    public function isSetDebtRecoveryEventList()
    {
                return !empty($this->_fields['DebtRecoveryEventList']['FieldValue']);
            }

    /**
     * Add values for DebtRecoveryEventList, return this.
     *
     * @param debtRecoveryEventList
     *             New values to add.
     *
     * @return This instance.
     */
    public function withDebtRecoveryEventList()
    {
        foreach (func_get_args() as $DebtRecoveryEventList)
        {
            $this->_fields['DebtRecoveryEventList']['FieldValue'][] = $DebtRecoveryEventList;
        }
        return $this;
    }

    /**
     * Get the value of the LoanServicingEventList property.
     *
     * @return List<LoanServicingEvent> LoanServicingEventList.
     */
    public function getLoanServicingEventList()
    {
        if ($this->_fields['LoanServicingEventList']['FieldValue'] == null)
        {
            $this->_fields['LoanServicingEventList']['FieldValue'] = array();
        }
        return $this->_fields['LoanServicingEventList']['FieldValue'];
    }

    /**
     * Set the value of the LoanServicingEventList property.
     *
     * @param array loanServicingEventList
     * @return this instance
     */
    public function setLoanServicingEventList($value)
    {
        if (!$this->_isNumericArray($value)) {
            $value = array ($value);
        }
        $this->_fields['LoanServicingEventList']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Clear LoanServicingEventList.
     */
    public function unsetLoanServicingEventList()
    {
        $this->_fields['LoanServicingEventList']['FieldValue'] = array();
    }

    /**
     * Check to see if LoanServicingEventList is set.
     *
     * @return true if LoanServicingEventList is set.
     */
    public function isSetLoanServicingEventList()
    {
                return !empty($this->_fields['LoanServicingEventList']['FieldValue']);
            }

    /**
     * Add values for LoanServicingEventList, return this.
     *
     * @param loanServicingEventList
     *             New values to add.
     *
     * @return This instance.
     */
    public function withLoanServicingEventList()
    {
        foreach (func_get_args() as $LoanServicingEventList)
        {
            $this->_fields['LoanServicingEventList']['FieldValue'][] = $LoanServicingEventList;
        }
        return $this;
    }

    /**
     * Get the value of the AdjustmentEventList property.
     *
     * @return List<AdjustmentEvent> AdjustmentEventList.
     */
    public function getAdjustmentEventList()
    {
        if ($this->_fields['AdjustmentEventList']['FieldValue'] == null)
        {
            $this->_fields['AdjustmentEventList']['FieldValue'] = array();
        }
        return $this->_fields['AdjustmentEventList']['FieldValue'];
    }

    /**
     * Set the value of the AdjustmentEventList property.
     *
     * @param array adjustmentEventList
     * @return this instance
     */
    public function setAdjustmentEventList($value)
    {
        if (!$this->_isNumericArray($value)) {
            $value = array ($value);
        }
        $this->_fields['AdjustmentEventList']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Clear AdjustmentEventList.
     */
    public function unsetAdjustmentEventList()
    {
        $this->_fields['AdjustmentEventList']['FieldValue'] = array();
    }

    /**
     * Check to see if AdjustmentEventList is set.
     *
     * @return true if AdjustmentEventList is set.
     */
    public function isSetAdjustmentEventList()
    {
                return !empty($this->_fields['AdjustmentEventList']['FieldValue']);
            }

    /**
     * Add values for AdjustmentEventList, return this.
     *
     * @param adjustmentEventList
     *             New values to add.
     *
     * @return This instance.
     */
    public function withAdjustmentEventList()
    {
        foreach (func_get_args() as $AdjustmentEventList)
        {
            $this->_fields['AdjustmentEventList']['FieldValue'][] = $AdjustmentEventList;
        }
        return $this;
    }

}


<?php
/**
 *  PHP Version 5
 *
 * @category    Amazon
 * @package     MarketplaceWebService
 * @copyright   Copyright 2009 Amazon Technologies, Inc.
 * @link        http://aws.amazon.com
 * @license     http://aws.amazon.com/apache2.0  Apache License, Version 2.0
 * @version     2009-01-01
 */
/*******************************************************************************
 *  Marketplace Web Service PHP5 Library
 *  Generated: Thu May 07 13:07:36 PDT 2009
 *
 */

/**
 * MarketplaceWebService_Model - base class for all model classes
 */
abstract class MarketplaceWebService_Model
{

    /** @var array */
    protected $fields = array();

    /**
     * Construct new model class
     *
     * @param mixed $data - DOMElement or Associative Array to construct from.
     * @throws Exception
     */
    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
     * @param $propertyValue
     * @return $this
     */
    public function __set($propertyName, $propertyValue)
    {
        $setter = "set$propertyName";
        $this->$setter($propertyValue);
        return $this;
    }

    /**
     * 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)) {
                $fieldType = $field['FieldType'];
                if (is_array($fieldType)) {
                    if ($this->isComplexType($fieldType[0])) {
                        foreach ($fieldValue as $item) {
                            $xml .= "<$fieldName>";
                            $xml .= $item->toXMLFragment();
                            $xml .= "</$fieldName>";
                        }
                    } else {
                        foreach ($fieldValue as $item) {
                            $xml .= "<$fieldName>";
                            $xml .= $this->escapeXML($item);
                            $xml .= "</$fieldName>";
                        }
                    }
                } else {
                    if ($this->isComplexType($fieldType)) {
                        $xml .= "<$fieldName>";
                        $xml .= $fieldValue->toXMLFragment();
                        $xml .= "</$fieldName>";
                    } else {
                        $xml .= "<$fieldName>";
                        $xml .= $this->escapeXML($fieldValue);
                        $xml .= "</$fieldName>";
                    }
                }
            }
        }
        return $xml;
    }

    /**
     * Escape special XML characters
     * @param $str
     * @return string with escaped XML characters
     */
    private function escapeXML($str)
    {
        $from = array("&", "<", ">", "'", "\"");
        $to = array("&", "<", ">", "'", """);
        return str_replace($from, $to, $str);
    }

    /**
     * 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);
        $xpath->registerNamespace('a', 'http://mws.amazonaws.com/doc/2009-01-01/');

        foreach ($this->fields as $fieldName => $field) {
            $fieldType = $field['FieldType'];
            if (is_array($fieldType)) {
                if ($this->isComplexType($fieldType[0])) {
                    $elements = $xpath->query("./a:$fieldName", $dom);
                    if ($elements->length >= 1) {
                        foreach ($elements as $element) {
                            $this->fields[$fieldName]['FieldValue'][] = new $fieldType[0]($element);
                        }
                    }
                } else {
                    $elements = $xpath->query("./a:$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("./a:$fieldName", $dom);
                    if ($elements->length == 1) {
                        $this->fields[$fieldName]['FieldValue'] = new $fieldType($elements->item(0));
                    }
                } else {
                    $element = $xpath->query("./a:$fieldName/text()", $dom);
                    $data = null;
                    if ($element->length == 1) {
                        switch ($this->fields[$fieldName]['FieldType']) {
                            case 'DateTime':
                                $data = new DateTime($element->item(0)->data, new DateTimeZone('UTC'));
                                break;
                            case 'bool':
                                $value = $element->item(0)->data;
                                $data = $value === 'true' ? true : false;
                                break;
                            default:
                                $data = $element->item(0)->data;
                                break;
                        }
                        $this->fields[$fieldName]['FieldValue'] = $data;
                    }
                }
            }
        }
    }

    /**
     * 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) {
                            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)) {
                        $this->fields[$fieldName]['FieldValue'] = new $fieldType($array[$fieldName]);
                    }
                } else {
                    if (array_key_exists($fieldName, $array)) {
                        $this->fields[$fieldName]['FieldValue'] = $array[$fieldName];
                    }
                }
            }
        }
    }

    /**
     * Determines if field is complex type
     *
     * @param string $fieldType field type name
     * @return int
     */
    private function isComplexType($fieldType)
    {
        return (bool) preg_match('/^MarketplaceWebService_Model_/', $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)
    {
        return is_array($var) && array_keys($var) === range(0, sizeof($var) - 1);
    }
}


<?php
/**
 *  PHP Version 5
 *
 * @category    Amazon
 * @package     MarketplaceWebService
 * @copyright   Copyright 2009 Amazon Technologies, Inc.
 * @link        http://aws.amazon.com
 * @license     http://aws.amazon.com/apache2.0  Apache License, Version 2.0
 * @version     2009-01-01
 */
/*******************************************************************************
 *  Marketplace Web Service PHP5 Library
 *  Generated: Thu May 07 13:07:36 PDT 2009
 *
 */

/**
 * MarketplaceWebService_Model_TypeList
 *
 * Properties:
 *

 *
 *
Type: string

 *
 *

 */
class MarketplaceWebService_Model_TypeList extends MarketplaceWebService_Model
{

    /**
     * Construct new MarketplaceWebService_Model_TypeList
     *
     * @param mixed $data DOMElement or Associative Array to construct from.
     *
     * Valid properties:
     *

     *
     *
Type: string

     *
     *

     */
    public function __construct($data = null)
    {
        $this->fields = array(
            'Type' => array('FieldValue' => array(), 'FieldType' => array('string')),
        );
        parent::__construct($data);
    }

    /**
     * Gets the value of the Type .
     *
     * @return array of string Type
     */
    public function getType()
    {
        return $this->fields['Type']['FieldValue'];
    }

    /**
     * Sets the value of the Type.
     *
     * @param string $type or an array of string Type
     * @return $this This instance
     */
    public function setType($type)
    {
        if (!$this->isNumericArray($type)) {
            $type = array($type);
        }
        $this->fields['Type']['FieldValue'] = $type;
        return $this;
    }

    /**
     * Sets single or multiple values of Type list via variable number of arguments.
     * For example, to set the list with two elements, simply pass two values as arguments to this function
     * withType($type1, $type2)
     *
     * @param string $stringArgs one or more Type
     * @return MarketplaceWebService_Model_TypeList  instance
     */
    public function withType($stringArgs)
    {
        foreach (func_get_args() as $type) {
            $this->fields['Type']['FieldValue'][] = $type;
        }
        return $this;
    }

    /**
     * Checks if Type list is non-empty
     *
     * @return bool true if Type list is non-empty
     */
    public function isSetType()
    {
        return count($this->fields['Type']['FieldValue']) > 0;
    }

}


<?php
/*******************************************************************************
 * Copyright 2009-2015 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  MWS Finances Service
 * @version  2015-05-01
 * Library Version: 2015-09-03
 * Generated: Thu Sep 03 17:55:25 GMT 2015
 */

/**
 *  @see MWSFinancesService_Model
 */

require_once (dirname(__FILE__) . '/../Model.php');

/**
 * MWSFinancesService_Model_ListFinancialEventGroupsByNextTokenResult
 *
 * Properties:
 *

 *
 *
NextToken: string

 *
FinancialEventGroupList: array

 *
 *

 */

 class MWSFinancesService_Model_ListFinancialEventGroupsByNextTokenResult extends MWSFinancesService_Model {

    public function __construct($data = null)
    {
    $this->_fields = array (
    'NextToken' => array('FieldValue' => null, 'FieldType' => 'string'),
    'FinancialEventGroupList' => array('FieldValue' => array(), 'FieldType' => array('MWSFinancesService_Model_FinancialEventGroup'), 'ListMemberName' => 'FinancialEventGroup'),
    );
    parent::__construct($data);
    }

    /**
     * Get the value of the NextToken property.
     *
     * @return String NextToken.
     */
    public function getNextToken()
    {
        return $this->_fields['NextToken']['FieldValue'];
    }

    /**
     * Set the value of the NextToken property.
     *
     * @param string nextToken
     * @return this instance
     */
    public function setNextToken($value)
    {
        $this->_fields['NextToken']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Check to see if NextToken is set.
     *
     * @return true if NextToken is set.
     */
    public function isSetNextToken()
    {
                return !is_null($this->_fields['NextToken']['FieldValue']);
            }

    /**
     * Set the value of NextToken, return this.
     *
     * @param nextToken
     *             The new value to set.
     *
     * @return This instance.
     */
    public function withNextToken($value)
    {
        $this->setNextToken($value);
        return $this;
    }

    /**
     * Get the value of the FinancialEventGroupList property.
     *
     * @return List<FinancialEventGroup> FinancialEventGroupList.
     */
    public function getFinancialEventGroupList()
    {
        if ($this->_fields['FinancialEventGroupList']['FieldValue'] == null)
        {
            $this->_fields['FinancialEventGroupList']['FieldValue'] = array();
        }
        return $this->_fields['FinancialEventGroupList']['FieldValue'];
    }

    /**
     * Set the value of the FinancialEventGroupList property.
     *
     * @param array financialEventGroupList
     * @return this instance
     */
    public function setFinancialEventGroupList($value)
    {
        if (!$this->_isNumericArray($value)) {
            $value = array ($value);
        }
        $this->_fields['FinancialEventGroupList']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Clear FinancialEventGroupList.
     */
    public function unsetFinancialEventGroupList()
    {
        $this->_fields['FinancialEventGroupList']['FieldValue'] = array();
    }

    /**
     * Check to see if FinancialEventGroupList is set.
     *
     * @return true if FinancialEventGroupList is set.
     */
    public function isSetFinancialEventGroupList()
    {
                return !empty($this->_fields['FinancialEventGroupList']['FieldValue']);
            }

    /**
     * Add values for FinancialEventGroupList, return this.
     *
     * @param financialEventGroupList
     *             New values to add.
     *
     * @return This instance.
     */
    public function withFinancialEventGroupList()
    {
        foreach (func_get_args() as $FinancialEventGroupList)
        {
            $this->_fields['FinancialEventGroupList']['FieldValue'][] = $FinancialEventGroupList;
        }
        return $this;
    }

}


<?php
/**
 *  PHP Version 5
 *
 * @category    Amazon
 * @package     MarketplaceWebService
 * @copyright   Copyright 2009 Amazon Technologies, Inc.
 * @link        http://aws.amazon.com
 * @license     http://aws.amazon.com/apache2.0  Apache License, Version 2.0
 * @version     2009-01-01
 */
/*******************************************************************************
 *  Marketplace Web Service PHP5 Library
 *  Generated: Thu May 07 13:07:36 PDT 2009
 *
 */

/**
 * MarketplaceWebService_Model_ErrorResponse
 *
 * Properties:
 *

 *
 *
Error: MarketplaceWebService_Model_Error

 *
RequestId: string

 *
 *

 */
class MarketplaceWebService_Model_ErrorResponse extends MarketplaceWebService_Model
{

    /**
     * Construct new MarketplaceWebService_Model_ErrorResponse
     *
     * @param mixed $data DOMElement or Associative Array to construct from.
     *
     * Valid properties:
     *

     *
     *
Error: MarketplaceWebService_Model_Error

     *
RequestId: string

     *
     *

     */
    public function __construct($data = null)
    {
        $this->fields = array(
            'Error' => array('FieldValue' => array(), 'FieldType' => 'MarketplaceWebService_Model_Error'),
            'RequestId' => array('FieldValue' => null, 'FieldType' => 'string'),
        );
        parent::__construct($data);
    }

    /**
     * Construct MarketplaceWebService_Model_ErrorResponse from XML string
     *
     * @param string $xml XML string to construct from
     * @return MarketplaceWebService_Model_ErrorResponse
     * @throws Exception
     */
    public static function fromXML($xml)
    {
        $dom = new DOMDocument();
        $dom->loadXML($xml);
        $xpath = new DOMXPath($dom);
        $xpath->registerNamespace('a', 'http://mws.amazonaws.com/doc/2009-01-01/');
        $response = $xpath->query('//a:ErrorResponse');
        if ($response->length == 1) {
            return new MarketplaceWebService_Model_ErrorResponse(($response->item(0)));
        } else {
            throw new Exception ("Unable to construct MarketplaceWebService_Model_ErrorResponse from provided XML.
                                  Make sure that ErrorResponse is a root element");
        }

    }

    /**
     * Gets the value of the Error.
     *
     * @return array of Error Error
     */
    public function getError()
    {
        return $this->fields['Error']['FieldValue'];
    }

    /**
     * Sets the value of the Error.
     *
     * @param mixed $error Error or an array of Error Error
     * @return $this This instance
     */
    public function setError($error)
    {
        if (!$this->_isNumericArray($error)) {
            $error = array($error);
        }
        $this->fields['Error']['FieldValue'] = $error;
        return $this;
    }

    /**
     * Sets single or multiple values of Error list via variable number of arguments.
     * For example, to set the list with two elements, simply pass two values as arguments to this function
     * withError($error1, $error2)
     *
     * @param MarketplaceWebService_Model_Error $errorArgs one or more Error
     * @return MarketplaceWebService_Model_ErrorResponse  instance
     */
    public function withError($errorArgs)
    {
        foreach (func_get_args() as $error) {
            $this->fields['Error']['FieldValue'][] = $error;
        }
        return $this;
    }

    /**
     * Checks if Error list is non-empty
     *
     * @return bool true if Error list is non-empty
     */
    public function isSetError()
    {
        return count($this->fields['Error']['FieldValue']) > 0;
    }

    /**
     * Gets the value of the RequestId property.
     *
     * @return string RequestId
     */
    public function getRequestId()
    {
        return $this->fields['RequestId']['FieldValue'];
    }

    /**
     * Sets the value of the RequestId property.
     *
     * @param string $value RequestId
     * @return $this This instance
     */
    public function setRequestId($value)
    {
        $this->fields['RequestId']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Sets the value of the RequestId and returns this instance
     *
     * @param string $value RequestId
     * @return MarketplaceWebService_Model_ErrorResponse instance
     */
    public function withRequestId($value)
    {
        $this->setRequestId($value);
        return $this;
    }

    /**
     * Checks if RequestId is set
     *
     * @return bool true if RequestId  is set
     */
    public function isSetRequestId()
    {
        return !is_null($this->fields['RequestId']['FieldValue']);
    }

    /**
     * XML Representation for this object
     *
     * @return string XML for this object
     */
    public function toXML()
    {
        $xml = "";
        $xml .= "<ErrorResponse xmlns=\"http://mws.amazonaws.com/doc/2009-01-01/\">";
        $xml .= $this->_toXMLFragment();
        $xml .= "</ErrorResponse>";
        return $xml;
    }

    private $_responseHeaderMetadata = null;

    public function getResponseHeaderMetadata()
    {
        return $this->_responseHeaderMetadata;
    }

    public function setResponseHeaderMetadata($responseHeaderMetadata)
    {
        return $this->_responseHeaderMetadata = $responseHeaderMetadata;
    }
}


<?php
/*******************************************************************************
 * Copyright 2009-2014 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 Products
 * @version  2011-10-01
 * Library Version: 2014-10-20
 * Generated: Fri Oct 17 17:59:56 GMT 2014
 */

/**
 * MarketplaceWebServiceProducts_Model_ProductList
 *
 * Properties:
 *

 *
 *
Product: array

 *
 *

 */
class MarketplaceWebServiceProducts_Model_ProductList extends MarketplaceWebServiceProducts_Model
{

    public function __construct($data = null)
    {
        $this->_fields = array(
            'Product' => array(
                'FieldValue' => array(),
                'FieldType' => array('MarketplaceWebServiceProducts_Model_Product')
            ),
        );
        parent::__construct($data);
    }

    /**
     * Get the value of the Product property.
     *
     * @return MarketplaceWebServiceProducts_Model_Product[] Product.
     */
    public function getProduct()
    {
        if ($this->_fields['Product']['FieldValue'] == null) {
            $this->_fields['Product']['FieldValue'] = array();
        }
        return $this->_fields['Product']['FieldValue'];
    }

    /**
     * Set the value of the Product property.
     *
     * @param array $value product
     * @return $this This instance
     */
    public function setProduct($value)
    {
        if (!$this->_isNumericArray($value)) {
            $value = array($value);
        }
        $this->_fields['Product']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Clear Product.
     */
    public function unsetProduct()
    {
        $this->_fields['Product']['FieldValue'] = array();
    }

    /**
     * Check to see if Product is set.
     *
     * @return true if Product is set.
     */
    public function isSetProduct()
    {
        return !empty($this->_fields['Product']['FieldValue']);
    }

    /**
     * Add values for Product, return this.
     *
     * @param product
     *             New values to add.
     *
     * @return $this This instance.
     */
    public function withProduct()
    {
        foreach (func_get_args() as $Product) {
            $this->_fields['Product']['FieldValue'][] = $Product;
        }
        return $this;
    }

}