<?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for extensionsInfo StructType
 * Meta informations extracted from the WSDL
 * - documentation: These tags are for Quick User/Phone Add page | These tags are for Quick User/Phone Add page | These tags are for Quick User/Phone Add page
 * @subpackage Structs
 */
class ExtensionsInfo extends XCommonMembersExtension
{
    /**
     * The extension
     * Meta informations extracted from the WSDL
     * - documentation: These tags are for Quick User/Phone Add page | These tags are for Quick User/Phone Add page | These tags are for Quick User/Phone Add page
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var XExtension[]
     */
    public $extension;
    /**
     * Constructor method for extensionsInfo
     * @uses ExtensionsInfo::setExtension()
     * @param XExtension[] $extension
     */
    public function __construct(array $extension = array())
    {
        $this
            ->setExtension($extension);
    }
    /**
     * Get extension value
     * @return XExtension[]|null
     */
    public function getExtension()
    {
        return $this->extension;
    }
    /**
     * Set extension value
     * @throws \InvalidArgumentException
     * @param XExtension[] $extension
     * @return ExtensionsInfo
     */
    public function setExtension(array $extension = array())
    {
        foreach ($extension as $extensionsInfoExtensionItem) {
            // validation for constraint: itemType
            if (!$extensionsInfoExtensionItem instanceof XExtension) {
                throw new \InvalidArgumentException(sprintf('The extension property can only contain items of XExtension, "%s" given', is_object($extensionsInfoExtensionItem) ? get_class($extensionsInfoExtensionItem) : gettype($extensionsInfoExtensionItem)), __LINE__);
            }
        }
        $this->extension = $extension;
        return $this;
    }
    /**
     * Add item to extension value
     * @throws \InvalidArgumentException
     * @param XExtension $item
     * @return ExtensionsInfo
     */
    public function addToExtension(XExtension $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof XExtension) {
            throw new \InvalidArgumentException(sprintf('The extension property can only contain items of XExtension, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->extension[] = $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 ExtensionsInfo
     */
    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__;
    }
}
