<?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for addParameters StructType
 * @subpackage Structs
 */
class AddParameters extends XCommonMembersExtension
{
    /**
     * The parameter
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 1
     * @var XIpPhoneServicesParameter[]
     */
    public $parameter;
    /**
     * Constructor method for addParameters
     * @uses AddParameters::setParameter()
     * @param XIpPhoneServicesParameter[] $parameter
     */
    public function __construct(array $parameter = array())
    {
        $this
            ->setParameter($parameter);
    }
    /**
     * Get parameter value
     * @return XIpPhoneServicesParameter[]
     */
    public function getParameter()
    {
        return $this->parameter;
    }
    /**
     * Set parameter value
     * @throws \InvalidArgumentException
     * @param XIpPhoneServicesParameter[] $parameter
     * @return AddParameters
     */
    public function setParameter(array $parameter = array())
    {
        foreach ($parameter as $addParametersParameterItem) {
            // validation for constraint: itemType
            if (!$addParametersParameterItem instanceof XIpPhoneServicesParameter) {
                throw new \InvalidArgumentException(sprintf('The parameter property can only contain items of XIpPhoneServicesParameter, "%s" given', is_object($addParametersParameterItem) ? get_class($addParametersParameterItem) : gettype($addParametersParameterItem)), __LINE__);
            }
        }
        $this->parameter = $parameter;
        return $this;
    }
    /**
     * Add item to parameter value
     * @throws \InvalidArgumentException
     * @param XIpPhoneServicesParameter $item
     * @return AddParameters
     */
    public function addToParameter(XIpPhoneServicesParameter $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof XIpPhoneServicesParameter) {
            throw new \InvalidArgumentException(sprintf('The parameter property can only contain items of XIpPhoneServicesParameter, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->parameter[] = $item;
        return $this;
    }
    /**
     * Method called when an object has been exported with var_export() functions
     * It allows to return an object instantiated with the values
     * @see AbstractStructBase::__set_state()
     * @uses AbstractStructBase::__set_state()
     * @param array $array the exported values
     * @return AddParameters
     */
    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__;
    }
}
