<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for StopMonitoringDeliveriesStructure StructType
 * Meta informations extracted from the WSDL
 * - documentation: Type for Deliveries for Stop Monitoring Service. Used in WSDL. | Delivery for Stop Event service.
 * @subpackage Structs
 */
class StopMonitoringDeliveriesStructure extends AbstractStructBase
{
    /**
     * The StopMonitoringDelivery
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * - ref: StopMonitoringDelivery
     * @var \StructType\StopMonitoringDeliveryStructure[]
     */
    public $StopMonitoringDelivery;
    /**
     * Constructor method for StopMonitoringDeliveriesStructure
     * @uses StopMonitoringDeliveriesStructure::setStopMonitoringDelivery()
     * @param \StructType\StopMonitoringDeliveryStructure[] $stopMonitoringDelivery
     */
    public function __construct(array $stopMonitoringDelivery = array())
    {
        $this
            ->setStopMonitoringDelivery($stopMonitoringDelivery);
    }
    /**
     * Get StopMonitoringDelivery value
     * @return \StructType\StopMonitoringDeliveryStructure[]|null
     */
    public function getStopMonitoringDelivery()
    {
        return $this->StopMonitoringDelivery;
    }
    /**
     * Set StopMonitoringDelivery value
     * @throws \InvalidArgumentException
     * @param \StructType\StopMonitoringDeliveryStructure[] $stopMonitoringDelivery
     * @return \StructType\StopMonitoringDeliveriesStructure
     */
    public function setStopMonitoringDelivery(array $stopMonitoringDelivery = array())
    {
        foreach ($stopMonitoringDelivery as $stopMonitoringDeliveriesStructureStopMonitoringDeliveryItem) {
            // validation for constraint: itemType
            if (!$stopMonitoringDeliveriesStructureStopMonitoringDeliveryItem instanceof \StructType\StopMonitoringDeliveryStructure) {
                throw new \InvalidArgumentException(sprintf('The StopMonitoringDelivery property can only contain items of \StructType\StopMonitoringDeliveryStructure, "%s" given', is_object($stopMonitoringDeliveriesStructureStopMonitoringDeliveryItem) ? get_class($stopMonitoringDeliveriesStructureStopMonitoringDeliveryItem) : gettype($stopMonitoringDeliveriesStructureStopMonitoringDeliveryItem)), __LINE__);
            }
        }
        $this->StopMonitoringDelivery = $stopMonitoringDelivery;
        return $this;
    }
    /**
     * Add item to StopMonitoringDelivery value
     * @throws \InvalidArgumentException
     * @param \StructType\StopMonitoringDeliveryStructure $item
     * @return \StructType\StopMonitoringDeliveriesStructure
     */
    public function addToStopMonitoringDelivery(\StructType\StopMonitoringDeliveryStructure $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\StopMonitoringDeliveryStructure) {
            throw new \InvalidArgumentException(sprintf('The StopMonitoringDelivery property can only contain items of \StructType\StopMonitoringDeliveryStructure, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->StopMonitoringDelivery[] = $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\StopMonitoringDeliveriesStructure
     */
    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__;
    }
}
