<?php

namespace CustomerManagement\ArrayType;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

/**
 * This class stands for ArrayOfIQGen2SignalSourceEnum ArrayType
 * @subpackage Arrays
 */
class ArrayOfIQGen2SignalSourceEnum extends AbstractStructArrayBase
{
    /**
     * The IQGen2SignalSourceEnum
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var string[]
     */
    public $IQGen2SignalSourceEnum;
    /**
     * Constructor method for ArrayOfIQGen2SignalSourceEnum
     * @uses ArrayOfIQGen2SignalSourceEnum::setIQGen2SignalSourceEnum()
     * @param string[] $iQGen2SignalSourceEnum
     */
    public function __construct(array $iQGen2SignalSourceEnum = array())
    {
        $this
            ->setIQGen2SignalSourceEnum($iQGen2SignalSourceEnum);
    }
    /**
     * Get IQGen2SignalSourceEnum value
     * @return string[]|null
     */
    public function getIQGen2SignalSourceEnum()
    {
        return $this->IQGen2SignalSourceEnum;
    }
    /**
     * This method is responsible for validating the values passed to the setIQGen2SignalSourceEnum method
     * This method is willingly generated in order to preserve the one-line inline validation within the setIQGen2SignalSourceEnum method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateIQGen2SignalSourceEnumForArrayConstraintsFromSetIQGen2SignalSourceEnum(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $arrayOfIQGen2SignalSourceEnumIQGen2SignalSourceEnumItem) {
            // validation for constraint: enumeration
            if (!\CustomerManagement\EnumType\IQGen2SignalSourceEnum::valueIsValid($arrayOfIQGen2SignalSourceEnumIQGen2SignalSourceEnumItem)) {
                $invalidValues[] = is_object($arrayOfIQGen2SignalSourceEnumIQGen2SignalSourceEnumItem) ? get_class($arrayOfIQGen2SignalSourceEnumIQGen2SignalSourceEnumItem) : sprintf('%s(%s)', gettype($arrayOfIQGen2SignalSourceEnumIQGen2SignalSourceEnumItem), var_export($arrayOfIQGen2SignalSourceEnumIQGen2SignalSourceEnumItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \CustomerManagement\EnumType\IQGen2SignalSourceEnum', is_array($invalidValues) ? implode(', ', $invalidValues) : var_export($invalidValues, true), implode(', ', \CustomerManagement\EnumType\IQGen2SignalSourceEnum::getValidValues()));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set IQGen2SignalSourceEnum value
     * @uses \CustomerManagement\EnumType\IQGen2SignalSourceEnum::valueIsValid()
     * @uses \CustomerManagement\EnumType\IQGen2SignalSourceEnum::getValidValues()
     * @throws \InvalidArgumentException
     * @param string[] $iQGen2SignalSourceEnum
     * @return \CustomerManagement\ArrayType\ArrayOfIQGen2SignalSourceEnum
     */
    public function setIQGen2SignalSourceEnum(array $iQGen2SignalSourceEnum = array())
    {
        // validation for constraint: array
        if ('' !== ($iQGen2SignalSourceEnumArrayErrorMessage = self::validateIQGen2SignalSourceEnumForArrayConstraintsFromSetIQGen2SignalSourceEnum($iQGen2SignalSourceEnum))) {
            throw new \InvalidArgumentException($iQGen2SignalSourceEnumArrayErrorMessage, __LINE__);
        }
        $this->IQGen2SignalSourceEnum = $iQGen2SignalSourceEnum;
        return $this;
    }
    /**
     * Add item to IQGen2SignalSourceEnum value
     * @uses \CustomerManagement\EnumType\IQGen2SignalSourceEnum::valueIsValid()
     * @uses \CustomerManagement\EnumType\IQGen2SignalSourceEnum::getValidValues()
     * @throws \InvalidArgumentException
     * @param string $item
     * @return \CustomerManagement\ArrayType\ArrayOfIQGen2SignalSourceEnum
     */
    public function addToIQGen2SignalSourceEnum($item)
    {
        // validation for constraint: enumeration
        if (!\CustomerManagement\EnumType\IQGen2SignalSourceEnum::valueIsValid($item)) {
            throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \CustomerManagement\EnumType\IQGen2SignalSourceEnum', is_array($item) ? implode(', ', $item) : var_export($item, true), implode(', ', \CustomerManagement\EnumType\IQGen2SignalSourceEnum::getValidValues())), __LINE__);
        }
        $this->IQGen2SignalSourceEnum[] = $item;
        return $this;
    }
    /**
     * Returns the current element
     * @see AbstractStructArrayBase::current()
     * @return string|null
     */
    public function current()
    {
        return parent::current();
    }
    /**
     * Returns the indexed element
     * @see AbstractStructArrayBase::item()
     * @param int $index
     * @return string|null
     */
    public function item($index)
    {
        return parent::item($index);
    }
    /**
     * Returns the first element
     * @see AbstractStructArrayBase::first()
     * @return string|null
     */
    public function first()
    {
        return parent::first();
    }
    /**
     * Returns the last element
     * @see AbstractStructArrayBase::last()
     * @return string|null
     */
    public function last()
    {
        return parent::last();
    }
    /**
     * Returns the element at the offset
     * @see AbstractStructArrayBase::offsetGet()
     * @param int $offset
     * @return string|null
     */
    public function offsetGet($offset)
    {
        return parent::offsetGet($offset);
    }
    /**
     * Add element to array
     * @see AbstractStructArrayBase::add()
     * @throws \InvalidArgumentException
     * @uses \CustomerManagement\EnumType\IQGen2SignalSourceEnum::valueIsValid()
     * @param string $item
     * @return \CustomerManagement\ArrayType\ArrayOfIQGen2SignalSourceEnum
     */
    public function add($item)
    {
        // validation for constraint: enumeration
        if (!\CustomerManagement\EnumType\IQGen2SignalSourceEnum::valueIsValid($item)) {
            throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \CustomerManagement\EnumType\IQGen2SignalSourceEnum', is_array($item) ? implode(', ', $item) : var_export($item, true), implode(', ', \CustomerManagement\EnumType\IQGen2SignalSourceEnum::getValidValues())), __LINE__);
        }
        return parent::add($item);
    }
    /**
     * Returns the attribute name
     * @see AbstractStructArrayBase::getAttributeName()
     * @return string IQGen2SignalSourceEnum
     */
    public function getAttributeName()
    {
        return 'IQGen2SignalSourceEnum';
    }
}
