<?php

namespace Array;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

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