<?php

namespace patest\ArrayType;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

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