<?php

namespace patest\ArrayType;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

/**
 * This class stands for
 * ArrayOfKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2 ArrayType
 * Meta information extracted from the WSDL
 * - nillable: true
 * - type: tns:ArrayOfKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2
 * @subpackage Arrays
 */
class ArrayOfKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2 extends AbstractStructArrayBase
{
    /**
     * The KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \patest\StructType\KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2[]
     */
    public $KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2;
    /**
     * Constructor method for
     * ArrayOfKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2
     * @uses ArrayOfKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2::setKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2()
     * @param \patest\StructType\KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2[] $keyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2
     */
    public function __construct(array $keyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2 = array())
    {
        $this
            ->setKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2($keyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2);
    }
    /**
     * Get KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2 value
     * @return \patest\StructType\KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2[]|null
     */
    public function getKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2()
    {
        return $this->KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2;
    }
    /**
     * This method is responsible for validating the values passed to the setKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2 method
     * This method is willingly generated in order to preserve the one-line inline validation within the setKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2 method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2ForArrayConstraintsFromSetKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $arrayOfKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2Item) {
            // validation for constraint: itemType
            if (!$arrayOfKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2Item instanceof \patest\StructType\KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2) {
                $invalidValues[] = is_object($arrayOfKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2Item) ? get_class($arrayOfKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2Item) : sprintf('%s(%s)', gettype($arrayOfKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2Item), var_export($arrayOfKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2Item, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2 property can only contain items of type \patest\StructType\KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2 value
     * @throws \InvalidArgumentException
     * @param \patest\StructType\KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2[] $keyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2
     * @return \patest\ArrayType\ArrayOfKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2
     */
    public function setKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2(array $keyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2 = array())
    {
        // validation for constraint: array
        if ('' !== ($keyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2ArrayErrorMessage = self::validateKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2ForArrayConstraintsFromSetKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2($keyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2))) {
            throw new \InvalidArgumentException($keyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2ArrayErrorMessage, __LINE__);
        }
        $this->KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2 = $keyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2;
        return $this;
    }
    /**
     * Add item to KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2
     * value
     * @throws \InvalidArgumentException
     * @param \patest\StructType\KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2 $item
     * @return \patest\ArrayType\ArrayOfKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2
     */
    public function addToKeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2(\patest\StructType\KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2 $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \patest\StructType\KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2) {
            throw new \InvalidArgumentException(sprintf('The KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2 property can only contain items of type \patest\StructType\KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2[] = $item;
        return $this;
    }
    /**
     * Returns the current element
     * @see AbstractStructArrayBase::current()
     * @return \patest\StructType\KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2|null
     */
    public function current()
    {
        return parent::current();
    }
    /**
     * Returns the indexed element
     * @see AbstractStructArrayBase::item()
     * @param int $index
     * @return \patest\StructType\KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2|null
     */
    public function item($index)
    {
        return parent::item($index);
    }
    /**
     * Returns the first element
     * @see AbstractStructArrayBase::first()
     * @return \patest\StructType\KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2|null
     */
    public function first()
    {
        return parent::first();
    }
    /**
     * Returns the last element
     * @see AbstractStructArrayBase::last()
     * @return \patest\StructType\KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2|null
     */
    public function last()
    {
        return parent::last();
    }
    /**
     * Returns the element at the offset
     * @see AbstractStructArrayBase::offsetGet()
     * @param int $offset
     * @return \patest\StructType\KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2|null
     */
    public function offsetGet($offset)
    {
        return parent::offsetGet($offset);
    }
    /**
     * Returns the attribute name
     * @see AbstractStructArrayBase::getAttributeName()
     * @return string KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2
     */
    public function getAttributeName()
    {
        return 'KeyValueOfEntityIdentityProductMaxTransactionCommissiono0TUsTQ2';
    }
}
