<?php

namespace patest\ArrayType;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

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