<?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

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