<?php

namespace patest\ArrayType;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

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