<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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