<?php

namespace patest\ArrayType;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

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