<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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