<?php

namespace patest\ArrayType;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

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