<?php

namespace patest\ArrayType;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

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