<?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for addOnModules StructType
 * Meta informations extracted from the WSDL
 * - documentation: Additional modules attached to the Phone.There can be 0,1, 2 or 3. | Additional modules attached to the Phone.There can be 0,1, 2 or 3. | Additional modules attached to the Phone.There can be 0,1 or 2. | Additional modules attached
 * to the Phone.There can be 0,1 or 2. | Additional modules attached to the Phone.There can be 0,1, 2 or 3. | Additional modules attached to the Phone.There can be 0,1 or 2. | Additional modules attached to the Phone.There can be 0,1, 2 or 3. |
 * Additional modules attached to the Phone.There can be 0,1, 2 or 3. | Additional modules attached to the Phone.There can be 0,1 or 2. | Additional modules attached to the Phone.There can be 0,1 or 2.
 * @subpackage Structs
 */
class AddOnModules extends AbstractStructBase
{
    /**
     * The addOnModule
     * Meta informations extracted from the WSDL
     * - maxOccurs: 2
     * - minOccurs: 0
     * @var XAddOnModule[]
     */
    public $addOnModule;
    /**
     * Constructor method for addOnModules
     * @uses AddOnModules::setAddOnModule()
     * @param XAddOnModule[] $addOnModule
     */
    public function __construct(array $addOnModule = array())
    {
        $this
            ->setAddOnModule($addOnModule);
    }
    /**
     * Get addOnModule value
     * @return XAddOnModule[]|null
     */
    public function getAddOnModule()
    {
        return $this->addOnModule;
    }
    /**
     * Set addOnModule value
     * @throws \InvalidArgumentException
     * @param XAddOnModule[] $addOnModule
     * @return AddOnModules
     */
    public function setAddOnModule(array $addOnModule = array())
    {
        foreach ($addOnModule as $addOnModulesAddOnModuleItem) {
            // validation for constraint: itemType
            if (!$addOnModulesAddOnModuleItem instanceof XAddOnModule) {
                throw new \InvalidArgumentException(sprintf('The addOnModule property can only contain items of XAddOnModule, "%s" given', is_object($addOnModulesAddOnModuleItem) ? get_class($addOnModulesAddOnModuleItem) : gettype($addOnModulesAddOnModuleItem)), __LINE__);
            }
        }
        $this->addOnModule = $addOnModule;
        return $this;
    }
    /**
     * Add item to addOnModule value
     * @throws \InvalidArgumentException
     * @param XAddOnModule $item
     * @return AddOnModules
     */
    public function addToAddOnModule(XAddOnModule $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof XAddOnModule) {
            throw new \InvalidArgumentException(sprintf('The addOnModule property can only contain items of XAddOnModule, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->addOnModule[] = $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 AddOnModules
     */
    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__;
    }
}
