<?php

namespace patest\ArrayType;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

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