<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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