<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Masked_Recruiting_Configuration_Request_ReferencesType
 * StructType
 * Meta information extracted from the WSDL
 * - documentation: Container for Masked Configurations Request References
 * @subpackage Structs
 */
class Masked_Recruiting_Configuration_Request_ReferencesType extends AbstractStructBase
{
    /**
     * The Masked_Recruiting_Configuration_Reference
     * Meta information extracted from the WSDL
     * - documentation: Masked Configuration References
     * - maxOccurs: unbounded
     * @var \StructType\Masked_ConfigurationObjectType[]
     */
    public $Masked_Recruiting_Configuration_Reference;
    /**
     * Constructor method for Masked_Recruiting_Configuration_Request_ReferencesType
     * @uses Masked_Recruiting_Configuration_Request_ReferencesType::setMasked_Recruiting_Configuration_Reference()
     * @param \StructType\Masked_ConfigurationObjectType[] $masked_Recruiting_Configuration_Reference
     */
    public function __construct(array $masked_Recruiting_Configuration_Reference = array())
    {
        $this
            ->setMasked_Recruiting_Configuration_Reference($masked_Recruiting_Configuration_Reference);
    }
    /**
     * Get Masked_Recruiting_Configuration_Reference value
     * @return \StructType\Masked_ConfigurationObjectType[]|null
     */
    public function getMasked_Recruiting_Configuration_Reference()
    {
        return $this->Masked_Recruiting_Configuration_Reference;
    }
    /**
     * This method is responsible for validating the values passed to the setMasked_Recruiting_Configuration_Reference method
     * This method is willingly generated in order to preserve the one-line inline validation within the setMasked_Recruiting_Configuration_Reference method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateMasked_Recruiting_Configuration_ReferenceForArrayConstraintsFromSetMasked_Recruiting_Configuration_Reference(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $masked_Recruiting_Configuration_Request_ReferencesTypeMasked_Recruiting_Configuration_ReferenceItem) {
            // validation for constraint: itemType
            if (!$masked_Recruiting_Configuration_Request_ReferencesTypeMasked_Recruiting_Configuration_ReferenceItem instanceof \StructType\Masked_ConfigurationObjectType) {
                $invalidValues[] = is_object($masked_Recruiting_Configuration_Request_ReferencesTypeMasked_Recruiting_Configuration_ReferenceItem) ? get_class($masked_Recruiting_Configuration_Request_ReferencesTypeMasked_Recruiting_Configuration_ReferenceItem) : sprintf('%s(%s)', gettype($masked_Recruiting_Configuration_Request_ReferencesTypeMasked_Recruiting_Configuration_ReferenceItem), var_export($masked_Recruiting_Configuration_Request_ReferencesTypeMasked_Recruiting_Configuration_ReferenceItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Masked_Recruiting_Configuration_Reference property can only contain items of type \StructType\Masked_ConfigurationObjectType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Masked_Recruiting_Configuration_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\Masked_ConfigurationObjectType[] $masked_Recruiting_Configuration_Reference
     * @return \StructType\Masked_Recruiting_Configuration_Request_ReferencesType
     */
    public function setMasked_Recruiting_Configuration_Reference(array $masked_Recruiting_Configuration_Reference = array())
    {
        // validation for constraint: array
        if ('' !== ($masked_Recruiting_Configuration_ReferenceArrayErrorMessage = self::validateMasked_Recruiting_Configuration_ReferenceForArrayConstraintsFromSetMasked_Recruiting_Configuration_Reference($masked_Recruiting_Configuration_Reference))) {
            throw new \InvalidArgumentException($masked_Recruiting_Configuration_ReferenceArrayErrorMessage, __LINE__);
        }
        $this->Masked_Recruiting_Configuration_Reference = $masked_Recruiting_Configuration_Reference;
        return $this;
    }
    /**
     * Add item to Masked_Recruiting_Configuration_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\Masked_ConfigurationObjectType $item
     * @return \StructType\Masked_Recruiting_Configuration_Request_ReferencesType
     */
    public function addToMasked_Recruiting_Configuration_Reference(\StructType\Masked_ConfigurationObjectType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Masked_ConfigurationObjectType) {
            throw new \InvalidArgumentException(sprintf('The Masked_Recruiting_Configuration_Reference property can only contain items of type \StructType\Masked_ConfigurationObjectType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Masked_Recruiting_Configuration_Reference[] = $item;
        return $this;
    }
}
