<?php

namespace patest\ArrayType;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

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