<?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for buttons StructType
 * Meta informations extracted from the WSDL
 * - documentation: The list of buttons on this model of Phone.The feature and label of first button cannot be modified. | The list of buttons on this model of Phone.The feature and label of first button cannot be modified.
 * @subpackage Structs
 */
class Buttons extends AbstractStructBase
{
    /**
     * The button
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var XButton[]
     */
    public $button;
    /**
     * Constructor method for buttons
     * @uses Buttons::setButton()
     * @param XButton[] $button
     */
    public function __construct(array $button = array())
    {
        $this
            ->setButton($button);
    }
    /**
     * Get button value
     * @return XButton[]|null
     */
    public function getButton()
    {
        return $this->button;
    }
    /**
     * Set button value
     * @throws \InvalidArgumentException
     * @param XButton[] $button
     * @return Buttons
     */
    public function setButton(array $button = array())
    {
        foreach ($button as $buttonsButtonItem) {
            // validation for constraint: itemType
            if (!$buttonsButtonItem instanceof XButton) {
                throw new \InvalidArgumentException(sprintf('The button property can only contain items of XButton, "%s" given', is_object($buttonsButtonItem) ? get_class($buttonsButtonItem) : gettype($buttonsButtonItem)), __LINE__);
            }
        }
        $this->button = $button;
        return $this;
    }
    /**
     * Add item to button value
     * @throws \InvalidArgumentException
     * @param XButton $item
     * @return Buttons
     */
    public function addToButton(XButton $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof XButton) {
            throw new \InvalidArgumentException(sprintf('The button property can only contain items of XButton, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->button[] = $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 Buttons
     */
    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__;
    }
}
