<?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

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