<?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for customUserFields StructType
 * @subpackage Structs
 */
class CustomUserFields extends AbstractStructBase
{
    /**
     * The customUserField
     * Meta informations extracted from the WSDL
     * - documentation: This Tag is valid only for GetUser | This Tag is valid only for GetUser | This Tag is valid only for GetUser
     * - maxOccurs: 5
     * - minOccurs: 0
     * @var XUserCustomUserField[]
     */
    public $customUserField;
    /**
     * Constructor method for customUserFields
     * @uses CustomUserFields::setCustomUserField()
     * @param XUserCustomUserField[] $customUserField
     */
    public function __construct(array $customUserField = array())
    {
        $this
            ->setCustomUserField($customUserField);
    }
    /**
     * Get customUserField value
     * @return XUserCustomUserField[]|null
     */
    public function getCustomUserField()
    {
        return $this->customUserField;
    }
    /**
     * Set customUserField value
     * @throws \InvalidArgumentException
     * @param XUserCustomUserField[] $customUserField
     * @return CustomUserFields
     */
    public function setCustomUserField(array $customUserField = array())
    {
        foreach ($customUserField as $customUserFieldsCustomUserFieldItem) {
            // validation for constraint: itemType
            if (!$customUserFieldsCustomUserFieldItem instanceof XUserCustomUserField) {
                throw new \InvalidArgumentException(sprintf('The customUserField property can only contain items of XUserCustomUserField, "%s" given', is_object($customUserFieldsCustomUserFieldItem) ? get_class($customUserFieldsCustomUserFieldItem) : gettype($customUserFieldsCustomUserFieldItem)), __LINE__);
            }
        }
        $this->customUserField = $customUserField;
        return $this;
    }
    /**
     * Add item to customUserField value
     * @throws \InvalidArgumentException
     * @param XUserCustomUserField $item
     * @return CustomUserFields
     */
    public function addToCustomUserField(XUserCustomUserField $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof XUserCustomUserField) {
            throw new \InvalidArgumentException(sprintf('The customUserField property can only contain items of XUserCustomUserField, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->customUserField[] = $item;
        return $this;
    }
    /**
     * Method called when an object has been exported with var_export() functions
     * It allows to return an object instantiated with the values
     * @see AbstractStructBase::__set_state()
     * @uses AbstractStructBase::__set_state()
     * @param array $array the exported values
     * @return CustomUserFields
     */
    public static function __set_state(array $array)
    {
        return parent::__set_state($array);
    }
    /**
     * Method returning the class name
     * @return string __CLASS__
     */
    public function __toString()
    {
        return __CLASS__;
    }
}
