<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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