<?php

namespace Array;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

/**
 * This class stands for ArrayOfKeyValueOfCustomerintbMZLxG6p Array
 * Meta information extracted from the WSDL
 * - nillable: true
 * - type: tns:ArrayOfKeyValueOfCustomerintbMZLxG6p
 * @subpackage Arrays
 * @date 2019-10-21
 */
class ArrayOfKeyValueOfCustomerintbMZLxG6p extends AbstractStructArrayBase
{
    /**
     * The KeyValueOfCustomerintbMZLxG6p
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \Struct\KeyValueOfCustomerintbMZLxG6p[]
     */
    public $KeyValueOfCustomerintbMZLxG6p;
    /**
     * Constructor method for ArrayOfKeyValueOfCustomerintbMZLxG6p
     * @uses ArrayOfKeyValueOfCustomerintbMZLxG6p::setKeyValueOfCustomerintbMZLxG6p()
     * @param \Struct\KeyValueOfCustomerintbMZLxG6p[] $keyValueOfCustomerintbMZLxG6p
     */
    public function __construct(array $keyValueOfCustomerintbMZLxG6p = array())
    {
        $this
            ->setKeyValueOfCustomerintbMZLxG6p($keyValueOfCustomerintbMZLxG6p);
    }
    /**
     * Get KeyValueOfCustomerintbMZLxG6p value
     * @return \Struct\KeyValueOfCustomerintbMZLxG6p[]|null
     */
    public function getKeyValueOfCustomerintbMZLxG6p()
    {
        return $this->KeyValueOfCustomerintbMZLxG6p;
    }
    /**
     * This method is responsible for validating the values passed to the setKeyValueOfCustomerintbMZLxG6p method
     * This method is willingly generated in order to preserve the one-line inline validation within the setKeyValueOfCustomerintbMZLxG6p method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateKeyValueOfCustomerintbMZLxG6pForArrayConstraintsFromSetKeyValueOfCustomerintbMZLxG6p(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $arrayOfKeyValueOfCustomerintbMZLxG6pKeyValueOfCustomerintbMZLxG6pItem) {
            // validation for constraint: itemType
            if (!$arrayOfKeyValueOfCustomerintbMZLxG6pKeyValueOfCustomerintbMZLxG6pItem instanceof \Struct\KeyValueOfCustomerintbMZLxG6p) {
                $invalidValues[] = is_object($arrayOfKeyValueOfCustomerintbMZLxG6pKeyValueOfCustomerintbMZLxG6pItem) ? get_class($arrayOfKeyValueOfCustomerintbMZLxG6pKeyValueOfCustomerintbMZLxG6pItem) : sprintf('%s(%s)', gettype($arrayOfKeyValueOfCustomerintbMZLxG6pKeyValueOfCustomerintbMZLxG6pItem), var_export($arrayOfKeyValueOfCustomerintbMZLxG6pKeyValueOfCustomerintbMZLxG6pItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The KeyValueOfCustomerintbMZLxG6p property can only contain items of type \Struct\KeyValueOfCustomerintbMZLxG6p, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set KeyValueOfCustomerintbMZLxG6p value
     * @throws \InvalidArgumentException
     * @param \Struct\KeyValueOfCustomerintbMZLxG6p[] $keyValueOfCustomerintbMZLxG6p
     * @return \Array\ArrayOfKeyValueOfCustomerintbMZLxG6p
     */
    public function setKeyValueOfCustomerintbMZLxG6p(array $keyValueOfCustomerintbMZLxG6p = array())
    {
        // validation for constraint: array
        if ('' !== ($keyValueOfCustomerintbMZLxG6pArrayErrorMessage = self::validateKeyValueOfCustomerintbMZLxG6pForArrayConstraintsFromSetKeyValueOfCustomerintbMZLxG6p($keyValueOfCustomerintbMZLxG6p))) {
            throw new \InvalidArgumentException($keyValueOfCustomerintbMZLxG6pArrayErrorMessage, __LINE__);
        }
        $this->KeyValueOfCustomerintbMZLxG6p = $keyValueOfCustomerintbMZLxG6p;
        return $this;
    }
    /**
     * Add item to KeyValueOfCustomerintbMZLxG6p value
     * @throws \InvalidArgumentException
     * @param \Struct\KeyValueOfCustomerintbMZLxG6p $item
     * @return \Array\ArrayOfKeyValueOfCustomerintbMZLxG6p
     */
    public function addToKeyValueOfCustomerintbMZLxG6p(\Struct\KeyValueOfCustomerintbMZLxG6p $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \Struct\KeyValueOfCustomerintbMZLxG6p) {
            throw new \InvalidArgumentException(sprintf('The KeyValueOfCustomerintbMZLxG6p property can only contain items of type \Struct\KeyValueOfCustomerintbMZLxG6p, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->KeyValueOfCustomerintbMZLxG6p[] = $item;
        return $this;
    }
    /**
     * Returns the current element
     * @see AbstractStructArrayBase::current()
     * @return \Struct\KeyValueOfCustomerintbMZLxG6p|null
     */
    public function current()
    {
        return parent::current();
    }
    /**
     * Returns the indexed element
     * @see AbstractStructArrayBase::item()
     * @param int $index
     * @return \Struct\KeyValueOfCustomerintbMZLxG6p|null
     */
    public function item($index)
    {
        return parent::item($index);
    }
    /**
     * Returns the first element
     * @see AbstractStructArrayBase::first()
     * @return \Struct\KeyValueOfCustomerintbMZLxG6p|null
     */
    public function first()
    {
        return parent::first();
    }
    /**
     * Returns the last element
     * @see AbstractStructArrayBase::last()
     * @return \Struct\KeyValueOfCustomerintbMZLxG6p|null
     */
    public function last()
    {
        return parent::last();
    }
    /**
     * Returns the element at the offset
     * @see AbstractStructArrayBase::offsetGet()
     * @param int $offset
     * @return \Struct\KeyValueOfCustomerintbMZLxG6p|null
     */
    public function offsetGet($offset)
    {
        return parent::offsetGet($offset);
    }
    /**
     * Returns the attribute name
     * @see AbstractStructArrayBase::getAttributeName()
     * @return string KeyValueOfCustomerintbMZLxG6p
     */
    public function getAttributeName()
    {
        return 'KeyValueOfCustomerintbMZLxG6p';
    }
    /**
     * Method called when an object has been exported with var_export() functions
     * It allows to return an object instantiated with the values
     * @see AbstractStructArrayBase::__set_state()
     * @uses AbstractStructArrayBase::__set_state()
     * @param array $array the exported values
     * @return \Array\ArrayOfKeyValueOfCustomerintbMZLxG6p
     */
    public static function __set_state(array $array)
    {
        return parent::__set_state($array);
    }
    /**
     * Method returning the class name
     * @return string __CLASS__
     */
    public function __toString()
    {
        return __CLASS__;
    }
}
