<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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