<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Payroll_Timesheet_Time_In_Time_Out_Request_ReferencesType
 * StructType
 * Meta information extracted from the WSDL
 * - documentation: Encapsulates references to Payroll Timesheet Time In Time Out.
 * @subpackage Structs
 */
class Payroll_Timesheet_Time_In_Time_Out_Request_ReferencesType extends AbstractStructBase
{
    /**
     * The Payroll_Timesheet_Time_In_Time_Out_Reference
     * Meta information extracted from the WSDL
     * - documentation: References specified to instances of Payroll Timesheet Time In Time Out.
     * - maxOccurs: unbounded
     * @var \StructType\Payroll_Timesheet_Time_In_Time_OutObjectType[]
     */
    public $Payroll_Timesheet_Time_In_Time_Out_Reference;
    /**
     * Constructor method for Payroll_Timesheet_Time_In_Time_Out_Request_ReferencesType
     * @uses Payroll_Timesheet_Time_In_Time_Out_Request_ReferencesType::setPayroll_Timesheet_Time_In_Time_Out_Reference()
     * @param \StructType\Payroll_Timesheet_Time_In_Time_OutObjectType[] $payroll_Timesheet_Time_In_Time_Out_Reference
     */
    public function __construct(array $payroll_Timesheet_Time_In_Time_Out_Reference = array())
    {
        $this
            ->setPayroll_Timesheet_Time_In_Time_Out_Reference($payroll_Timesheet_Time_In_Time_Out_Reference);
    }
    /**
     * Get Payroll_Timesheet_Time_In_Time_Out_Reference value
     * @return \StructType\Payroll_Timesheet_Time_In_Time_OutObjectType[]|null
     */
    public function getPayroll_Timesheet_Time_In_Time_Out_Reference()
    {
        return $this->Payroll_Timesheet_Time_In_Time_Out_Reference;
    }
    /**
     * This method is responsible for validating the values passed to the setPayroll_Timesheet_Time_In_Time_Out_Reference method
     * This method is willingly generated in order to preserve the one-line inline validation within the setPayroll_Timesheet_Time_In_Time_Out_Reference method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validatePayroll_Timesheet_Time_In_Time_Out_ReferenceForArrayConstraintsFromSetPayroll_Timesheet_Time_In_Time_Out_Reference(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $payroll_Timesheet_Time_In_Time_Out_Request_ReferencesTypePayroll_Timesheet_Time_In_Time_Out_ReferenceItem) {
            // validation for constraint: itemType
            if (!$payroll_Timesheet_Time_In_Time_Out_Request_ReferencesTypePayroll_Timesheet_Time_In_Time_Out_ReferenceItem instanceof \StructType\Payroll_Timesheet_Time_In_Time_OutObjectType) {
                $invalidValues[] = is_object($payroll_Timesheet_Time_In_Time_Out_Request_ReferencesTypePayroll_Timesheet_Time_In_Time_Out_ReferenceItem) ? get_class($payroll_Timesheet_Time_In_Time_Out_Request_ReferencesTypePayroll_Timesheet_Time_In_Time_Out_ReferenceItem) : sprintf('%s(%s)', gettype($payroll_Timesheet_Time_In_Time_Out_Request_ReferencesTypePayroll_Timesheet_Time_In_Time_Out_ReferenceItem), var_export($payroll_Timesheet_Time_In_Time_Out_Request_ReferencesTypePayroll_Timesheet_Time_In_Time_Out_ReferenceItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Payroll_Timesheet_Time_In_Time_Out_Reference property can only contain items of type \StructType\Payroll_Timesheet_Time_In_Time_OutObjectType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Payroll_Timesheet_Time_In_Time_Out_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\Payroll_Timesheet_Time_In_Time_OutObjectType[] $payroll_Timesheet_Time_In_Time_Out_Reference
     * @return \StructType\Payroll_Timesheet_Time_In_Time_Out_Request_ReferencesType
     */
    public function setPayroll_Timesheet_Time_In_Time_Out_Reference(array $payroll_Timesheet_Time_In_Time_Out_Reference = array())
    {
        // validation for constraint: array
        if ('' !== ($payroll_Timesheet_Time_In_Time_Out_ReferenceArrayErrorMessage = self::validatePayroll_Timesheet_Time_In_Time_Out_ReferenceForArrayConstraintsFromSetPayroll_Timesheet_Time_In_Time_Out_Reference($payroll_Timesheet_Time_In_Time_Out_Reference))) {
            throw new \InvalidArgumentException($payroll_Timesheet_Time_In_Time_Out_ReferenceArrayErrorMessage, __LINE__);
        }
        $this->Payroll_Timesheet_Time_In_Time_Out_Reference = $payroll_Timesheet_Time_In_Time_Out_Reference;
        return $this;
    }
    /**
     * Add item to Payroll_Timesheet_Time_In_Time_Out_Reference value
     * @throws \InvalidArgumentException
     * @param \StructType\Payroll_Timesheet_Time_In_Time_OutObjectType $item
     * @return \StructType\Payroll_Timesheet_Time_In_Time_Out_Request_ReferencesType
     */
    public function addToPayroll_Timesheet_Time_In_Time_Out_Reference(\StructType\Payroll_Timesheet_Time_In_Time_OutObjectType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Payroll_Timesheet_Time_In_Time_OutObjectType) {
            throw new \InvalidArgumentException(sprintf('The Payroll_Timesheet_Time_In_Time_Out_Reference property can only contain items of type \StructType\Payroll_Timesheet_Time_In_Time_OutObjectType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Payroll_Timesheet_Time_In_Time_Out_Reference[] = $item;
        return $this;
    }
}
