<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">&lt;?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for addShipmentResponse StructType
 * @subpackage Structs
 */
class AddShipmentResponse extends AbstractStructBase
{
    /**
     * The retval
     * Meta information extracted from the WSDL
     * - maxOccurs: 500
     * - minOccurs: 1
     * @var AddShipmentResponseItemType[]
     */
    public $retval;
    /**
     * Constructor method for addShipmentResponse
     * @uses AddShipmentResponse::setRetval()
     * @param AddShipmentResponseItemType[] $retval
     */
    public function __construct(array $retval = array())
    {
        $this
            -&gt;setRetval($retval);
    }
    /**
     * Get retval value
     * @return AddShipmentResponseItemType[]
     */
    public function getRetval()
    {
        return $this-&gt;retval;
    }
    /**
     * This method is responsible for validating the values passed to the setRetval method
     * This method is willingly generated in order to preserve the one-line inline validation within the setRetval method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateRetvalForArrayConstraintsFromSetRetval(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $addShipmentResponseRetvalItem) {
            // validation for constraint: itemType
            if (!$addShipmentResponseRetvalItem instanceof AddShipmentResponseItemType) {
                $invalidValues[] = is_object($addShipmentResponseRetvalItem) ? get_class($addShipmentResponseRetvalItem) : sprintf('%s(%s)', gettype($addShipmentResponseRetvalItem), var_export($addShipmentResponseRetvalItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The retval property can only contain items of type AddShipmentResponseItemType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set retval value
     * @throws \InvalidArgumentException
     * @param AddShipmentResponseItemType[] $retval
     * @return AddShipmentResponse
     */
    public function setRetval(array $retval = array())
    {
        // validation for constraint: array
        if ('' !== ($retvalArrayErrorMessage = self::validateRetvalForArrayConstraintsFromSetRetval($retval))) {
            throw new \InvalidArgumentException($retvalArrayErrorMessage, __LINE__);
        }
        // validation for constraint: maxOccurs(500)
        if (is_array($retval) &amp;&amp; count($retval) &gt; 500) {
            throw new \InvalidArgumentException(sprintf('Invalid count of %s, the number of elements contained by the property must be less than or equal to 500', count($retval)), __LINE__);
        }
        $this-&gt;retval = $retval;
        return $this;
    }
    /**
     * Add item to retval value
     * @throws \InvalidArgumentException
     * @param AddShipmentResponseItemType $item
     * @return AddShipmentResponse
     */
    public function addToRetval(AddShipmentResponseItemType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof AddShipmentResponseItemType) {
            throw new \InvalidArgumentException(sprintf('The retval property can only contain items of type AddShipmentResponseItemType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        // validation for constraint: maxOccurs(500)
        if (is_array($this-&gt;retval) &amp;&amp; count($this-&gt;retval) &gt;= 500) {
            throw new \InvalidArgumentException(sprintf('You can\'t add anymore element to this property that already contains %s elements, the number of elements contained by the property must be less than or equal to 500', count($this-&gt;retval)), __LINE__);
        }
        $this-&gt;retval[] = $item;
        return $this;
    }
}
</pre></body></html>