<?php

namespace patest\ArrayType;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

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