<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Travel_City_Response_DataType StructType
 * Meta information extracted from the WSDL
 * - documentation: Wrapper Element that includes Travel City Instance and Data
 * @subpackage Structs
 */
class Travel_City_Response_DataType extends AbstractStructBase
{
    /**
     * The Travel_City
     * Meta information extracted from the WSDL
     * - documentation: Travel City
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Travel_CityType[]
     */
    public $Travel_City;
    /**
     * Constructor method for Travel_City_Response_DataType
     * @uses Travel_City_Response_DataType::setTravel_City()
     * @param \StructType\Travel_CityType[] $travel_City
     */
    public function __construct(array $travel_City = array())
    {
        $this
            ->setTravel_City($travel_City);
    }
    /**
     * Get Travel_City value
     * @return \StructType\Travel_CityType[]|null
     */
    public function getTravel_City()
    {
        return $this->Travel_City;
    }
    /**
     * This method is responsible for validating the values passed to the setTravel_City method
     * This method is willingly generated in order to preserve the one-line inline validation within the setTravel_City method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateTravel_CityForArrayConstraintsFromSetTravel_City(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $travel_City_Response_DataTypeTravel_CityItem) {
            // validation for constraint: itemType
            if (!$travel_City_Response_DataTypeTravel_CityItem instanceof \StructType\Travel_CityType) {
                $invalidValues[] = is_object($travel_City_Response_DataTypeTravel_CityItem) ? get_class($travel_City_Response_DataTypeTravel_CityItem) : sprintf('%s(%s)', gettype($travel_City_Response_DataTypeTravel_CityItem), var_export($travel_City_Response_DataTypeTravel_CityItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Travel_City property can only contain items of type \StructType\Travel_CityType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Travel_City value
     * @throws \InvalidArgumentException
     * @param \StructType\Travel_CityType[] $travel_City
     * @return \StructType\Travel_City_Response_DataType
     */
    public function setTravel_City(array $travel_City = array())
    {
        // validation for constraint: array
        if ('' !== ($travel_CityArrayErrorMessage = self::validateTravel_CityForArrayConstraintsFromSetTravel_City($travel_City))) {
            throw new \InvalidArgumentException($travel_CityArrayErrorMessage, __LINE__);
        }
        $this->Travel_City = $travel_City;
        return $this;
    }
    /**
     * Add item to Travel_City value
     * @throws \InvalidArgumentException
     * @param \StructType\Travel_CityType $item
     * @return \StructType\Travel_City_Response_DataType
     */
    public function addToTravel_City(\StructType\Travel_CityType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Travel_CityType) {
            throw new \InvalidArgumentException(sprintf('The Travel_City property can only contain items of type \StructType\Travel_CityType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Travel_City[] = $item;
        return $this;
    }
}
