<?php

namespace patest\ArrayType;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

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