<?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

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