<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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