<?php

namespace patest\ArrayType;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

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