<?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for parameters StructType
 * @subpackage Structs
 */
class Parameters extends XCommonMembersExtension
{
    /**
     * The parameter
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var XIpPhoneServicesParameter[]
     */
    public $parameter;
    /**
     * Constructor method for parameters
     * @uses Parameters::setParameter()
     * @param XIpPhoneServicesParameter[] $parameter
     */
    public function __construct(array $parameter = array())
    {
        $this
            ->setParameter($parameter);
    }
    /**
     * Get parameter value
     * @return XIpPhoneServicesParameter[]|null
     */
    public function getParameter()
    {
        return $this->parameter;
    }
    /**
     * Set parameter value
     * @throws \InvalidArgumentException
     * @param XIpPhoneServicesParameter[] $parameter
     * @return Parameters
     */
    public function setParameter(array $parameter = array())
    {
        foreach ($parameter as $parametersParameterItem) {
            // validation for constraint: itemType
            if (!$parametersParameterItem instanceof XIpPhoneServicesParameter) {
                throw new \InvalidArgumentException(sprintf('The parameter property can only contain items of XIpPhoneServicesParameter, "%s" given', is_object($parametersParameterItem) ? get_class($parametersParameterItem) : gettype($parametersParameterItem)), __LINE__);
            }
        }
        $this->parameter = $parameter;
        return $this;
    }
    /**
     * Add item to parameter value
     * @throws \InvalidArgumentException
     * @param XIpPhoneServicesParameter $item
     * @return Parameters
     */
    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 Parameters
     */
    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__;
    }
}
