<?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

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