<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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