<?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

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