<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Payroll_Timesheet_Time_In_Time_Out_Response_DataType
 * StructType
 * Meta information extracted from the WSDL
 * - documentation: A wrapper element that contains all the Payroll Timesheet Time In Time Out objects returned by the web service for the criteria and/or references provided.
 * @subpackage Structs
 */
class Payroll_Timesheet_Time_In_Time_Out_Response_DataType extends AbstractStructBase
{
    /**
     * The Payroll_Timesheet_Time_In_Time_Out
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Payroll_Timesheet_Time_In_Time_OutType[]
     */
    public $Payroll_Timesheet_Time_In_Time_Out;
    /**
     * Constructor method for Payroll_Timesheet_Time_In_Time_Out_Response_DataType
     * @uses Payroll_Timesheet_Time_In_Time_Out_Response_DataType::setPayroll_Timesheet_Time_In_Time_Out()
     * @param \StructType\Payroll_Timesheet_Time_In_Time_OutType[] $payroll_Timesheet_Time_In_Time_Out
     */
    public function __construct(array $payroll_Timesheet_Time_In_Time_Out = array())
    {
        $this
            ->setPayroll_Timesheet_Time_In_Time_Out($payroll_Timesheet_Time_In_Time_Out);
    }
    /**
     * Get Payroll_Timesheet_Time_In_Time_Out value
     * @return \StructType\Payroll_Timesheet_Time_In_Time_OutType[]|null
     */
    public function getPayroll_Timesheet_Time_In_Time_Out()
    {
        return $this->Payroll_Timesheet_Time_In_Time_Out;
    }
    /**
     * This method is responsible for validating the values passed to the setPayroll_Timesheet_Time_In_Time_Out method
     * This method is willingly generated in order to preserve the one-line inline validation within the setPayroll_Timesheet_Time_In_Time_Out 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_OutForArrayConstraintsFromSetPayroll_Timesheet_Time_In_Time_Out(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $payroll_Timesheet_Time_In_Time_Out_Response_DataTypePayroll_Timesheet_Time_In_Time_OutItem) {
            // validation for constraint: itemType
            if (!$payroll_Timesheet_Time_In_Time_Out_Response_DataTypePayroll_Timesheet_Time_In_Time_OutItem instanceof \StructType\Payroll_Timesheet_Time_In_Time_OutType) {
                $invalidValues[] = is_object($payroll_Timesheet_Time_In_Time_Out_Response_DataTypePayroll_Timesheet_Time_In_Time_OutItem) ? get_class($payroll_Timesheet_Time_In_Time_Out_Response_DataTypePayroll_Timesheet_Time_In_Time_OutItem) : sprintf('%s(%s)', gettype($payroll_Timesheet_Time_In_Time_Out_Response_DataTypePayroll_Timesheet_Time_In_Time_OutItem), var_export($payroll_Timesheet_Time_In_Time_Out_Response_DataTypePayroll_Timesheet_Time_In_Time_OutItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Payroll_Timesheet_Time_In_Time_Out property can only contain items of type \StructType\Payroll_Timesheet_Time_In_Time_OutType, %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 value
     * @throws \InvalidArgumentException
     * @param \StructType\Payroll_Timesheet_Time_In_Time_OutType[] $payroll_Timesheet_Time_In_Time_Out
     * @return \StructType\Payroll_Timesheet_Time_In_Time_Out_Response_DataType
     */
    public function setPayroll_Timesheet_Time_In_Time_Out(array $payroll_Timesheet_Time_In_Time_Out = array())
    {
        // validation for constraint: array
        if ('' !== ($payroll_Timesheet_Time_In_Time_OutArrayErrorMessage = self::validatePayroll_Timesheet_Time_In_Time_OutForArrayConstraintsFromSetPayroll_Timesheet_Time_In_Time_Out($payroll_Timesheet_Time_In_Time_Out))) {
            throw new \InvalidArgumentException($payroll_Timesheet_Time_In_Time_OutArrayErrorMessage, __LINE__);
        }
        $this->Payroll_Timesheet_Time_In_Time_Out = $payroll_Timesheet_Time_In_Time_Out;
        return $this;
    }
    /**
     * Add item to Payroll_Timesheet_Time_In_Time_Out value
     * @throws \InvalidArgumentException
     * @param \StructType\Payroll_Timesheet_Time_In_Time_OutType $item
     * @return \StructType\Payroll_Timesheet_Time_In_Time_Out_Response_DataType
     */
    public function addToPayroll_Timesheet_Time_In_Time_Out(\StructType\Payroll_Timesheet_Time_In_Time_OutType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Payroll_Timesheet_Time_In_Time_OutType) {
            throw new \InvalidArgumentException(sprintf('The Payroll_Timesheet_Time_In_Time_Out property can only contain items of type \StructType\Payroll_Timesheet_Time_In_Time_OutType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Payroll_Timesheet_Time_In_Time_Out[] = $item;
        return $this;
    }
}
