<?php

namespace dgsoft\StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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