<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Asset_Shares_Response_DataType StructType
 * Meta information extracted from the WSDL
 * - documentation: Element containing asset shares response data
 * @subpackage Structs
 */
class Asset_Shares_Response_DataType extends AbstractStructBase
{
    /**
     * The Asset_Shares
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Asset_SharesType[]
     */
    public $Asset_Shares;
    /**
     * Constructor method for Asset_Shares_Response_DataType
     * @uses Asset_Shares_Response_DataType::setAsset_Shares()
     * @param \StructType\Asset_SharesType[] $asset_Shares
     */
    public function __construct(array $asset_Shares = array())
    {
        $this
            ->setAsset_Shares($asset_Shares);
    }
    /**
     * Get Asset_Shares value
     * @return \StructType\Asset_SharesType[]|null
     */
    public function getAsset_Shares()
    {
        return $this->Asset_Shares;
    }
    /**
     * This method is responsible for validating the values passed to the setAsset_Shares method
     * This method is willingly generated in order to preserve the one-line inline validation within the setAsset_Shares method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateAsset_SharesForArrayConstraintsFromSetAsset_Shares(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $asset_Shares_Response_DataTypeAsset_SharesItem) {
            // validation for constraint: itemType
            if (!$asset_Shares_Response_DataTypeAsset_SharesItem instanceof \StructType\Asset_SharesType) {
                $invalidValues[] = is_object($asset_Shares_Response_DataTypeAsset_SharesItem) ? get_class($asset_Shares_Response_DataTypeAsset_SharesItem) : sprintf('%s(%s)', gettype($asset_Shares_Response_DataTypeAsset_SharesItem), var_export($asset_Shares_Response_DataTypeAsset_SharesItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Asset_Shares property can only contain items of type \StructType\Asset_SharesType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Asset_Shares value
     * @throws \InvalidArgumentException
     * @param \StructType\Asset_SharesType[] $asset_Shares
     * @return \StructType\Asset_Shares_Response_DataType
     */
    public function setAsset_Shares(array $asset_Shares = array())
    {
        // validation for constraint: array
        if ('' !== ($asset_SharesArrayErrorMessage = self::validateAsset_SharesForArrayConstraintsFromSetAsset_Shares($asset_Shares))) {
            throw new \InvalidArgumentException($asset_SharesArrayErrorMessage, __LINE__);
        }
        $this->Asset_Shares = $asset_Shares;
        return $this;
    }
    /**
     * Add item to Asset_Shares value
     * @throws \InvalidArgumentException
     * @param \StructType\Asset_SharesType $item
     * @return \StructType\Asset_Shares_Response_DataType
     */
    public function addToAsset_Shares(\StructType\Asset_SharesType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Asset_SharesType) {
            throw new \InvalidArgumentException(sprintf('The Asset_Shares property can only contain items of type \StructType\Asset_SharesType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Asset_Shares[] = $item;
        return $this;
    }
}
