<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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