<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for StopTimetablePermissions StructType
 * Meta informations extracted from the WSDL
 * - documentation: Participant's permissions to use the service.
 * @subpackage Structs
 */
class StopTimetablePermissions extends PermissionsStructure
{
    /**
     * The StopTimetablePermission
     * Meta informations extracted from the WSDL
     * - documentation: Permission for a single participant or all participants to use an aspect of the service.
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\StopTimetableServicePermissionStructure[]
     */
    public $StopTimetablePermission;
    /**
     * Constructor method for StopTimetablePermissions
     * @uses StopTimetablePermissions::setStopTimetablePermission()
     * @param \StructType\StopTimetableServicePermissionStructure[] $stopTimetablePermission
     */
    public function __construct(array $stopTimetablePermission = array())
    {
        $this
            ->setStopTimetablePermission($stopTimetablePermission);
    }
    /**
     * Get StopTimetablePermission value
     * @return \StructType\StopTimetableServicePermissionStructure[]|null
     */
    public function getStopTimetablePermission()
    {
        return $this->StopTimetablePermission;
    }
    /**
     * Set StopTimetablePermission value
     * @throws \InvalidArgumentException
     * @param \StructType\StopTimetableServicePermissionStructure[] $stopTimetablePermission
     * @return \StructType\StopTimetablePermissions
     */
    public function setStopTimetablePermission(array $stopTimetablePermission = array())
    {
        foreach ($stopTimetablePermission as $stopTimetablePermissionsStopTimetablePermissionItem) {
            // validation for constraint: itemType
            if (!$stopTimetablePermissionsStopTimetablePermissionItem instanceof \StructType\StopTimetableServicePermissionStructure) {
                throw new \InvalidArgumentException(sprintf('The StopTimetablePermission property can only contain items of \StructType\StopTimetableServicePermissionStructure, "%s" given', is_object($stopTimetablePermissionsStopTimetablePermissionItem) ? get_class($stopTimetablePermissionsStopTimetablePermissionItem) : gettype($stopTimetablePermissionsStopTimetablePermissionItem)), __LINE__);
            }
        }
        $this->StopTimetablePermission = $stopTimetablePermission;
        return $this;
    }
    /**
     * Add item to StopTimetablePermission value
     * @throws \InvalidArgumentException
     * @param \StructType\StopTimetableServicePermissionStructure $item
     * @return \StructType\StopTimetablePermissions
     */
    public function addToStopTimetablePermission(\StructType\StopTimetableServicePermissionStructure $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\StopTimetableServicePermissionStructure) {
            throw new \InvalidArgumentException(sprintf('The StopTimetablePermission property can only contain items of \StructType\StopTimetableServicePermissionStructure, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->StopTimetablePermission[] = $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\StopTimetablePermissions
     */
    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__;
    }
}
