<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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