<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for PaycheckJournalEmployeeTaxList StructType
 * @subpackage Structs
 */
class PaycheckJournalEmployeeTaxList extends AbstractStructBase
{
    /**
     * The paycheckJournalEmployeeTax
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\PaycheckJournalEmployeeTax[]
     */
    public $paycheckJournalEmployeeTax;
    /**
     * The replaceAll
     * Meta information extracted from the WSDL
     * - default: true
     * @var bool
     */
    public $replaceAll;
    /**
     * Constructor method for PaycheckJournalEmployeeTaxList
     * @uses PaycheckJournalEmployeeTaxList::setPaycheckJournalEmployeeTax()
     * @uses PaycheckJournalEmployeeTaxList::setReplaceAll()
     * @param \StructType\PaycheckJournalEmployeeTax[] $paycheckJournalEmployeeTax
     * @param bool $replaceAll
     */
    public function __construct(array $paycheckJournalEmployeeTax = array(), $replaceAll = true)
    {
        $this
            ->setPaycheckJournalEmployeeTax($paycheckJournalEmployeeTax)
            ->setReplaceAll($replaceAll);
    }
    /**
     * Get paycheckJournalEmployeeTax value
     * @return \StructType\PaycheckJournalEmployeeTax[]|null
     */
    public function getPaycheckJournalEmployeeTax()
    {
        return $this->paycheckJournalEmployeeTax;
    }
    /**
     * This method is responsible for validating the values passed to the setPaycheckJournalEmployeeTax method
     * This method is willingly generated in order to preserve the one-line inline validation within the setPaycheckJournalEmployeeTax method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validatePaycheckJournalEmployeeTaxForArrayConstraintsFromSetPaycheckJournalEmployeeTax(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $paycheckJournalEmployeeTaxListPaycheckJournalEmployeeTaxItem) {
            // validation for constraint: itemType
            if (!$paycheckJournalEmployeeTaxListPaycheckJournalEmployeeTaxItem instanceof \StructType\PaycheckJournalEmployeeTax) {
                $invalidValues[] = is_object($paycheckJournalEmployeeTaxListPaycheckJournalEmployeeTaxItem) ? get_class($paycheckJournalEmployeeTaxListPaycheckJournalEmployeeTaxItem) : sprintf('%s(%s)', gettype($paycheckJournalEmployeeTaxListPaycheckJournalEmployeeTaxItem), var_export($paycheckJournalEmployeeTaxListPaycheckJournalEmployeeTaxItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The paycheckJournalEmployeeTax property can only contain items of type \StructType\PaycheckJournalEmployeeTax, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set paycheckJournalEmployeeTax value
     * @throws \InvalidArgumentException
     * @param \StructType\PaycheckJournalEmployeeTax[] $paycheckJournalEmployeeTax
     * @return \StructType\PaycheckJournalEmployeeTaxList
     */
    public function setPaycheckJournalEmployeeTax(array $paycheckJournalEmployeeTax = array())
    {
        // validation for constraint: array
        if ('' !== ($paycheckJournalEmployeeTaxArrayErrorMessage = self::validatePaycheckJournalEmployeeTaxForArrayConstraintsFromSetPaycheckJournalEmployeeTax($paycheckJournalEmployeeTax))) {
            throw new \InvalidArgumentException($paycheckJournalEmployeeTaxArrayErrorMessage, __LINE__);
        }
        $this->paycheckJournalEmployeeTax = $paycheckJournalEmployeeTax;
        return $this;
    }
    /**
     * Add item to paycheckJournalEmployeeTax value
     * @throws \InvalidArgumentException
     * @param \StructType\PaycheckJournalEmployeeTax $item
     * @return \StructType\PaycheckJournalEmployeeTaxList
     */
    public function addToPaycheckJournalEmployeeTax(\StructType\PaycheckJournalEmployeeTax $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\PaycheckJournalEmployeeTax) {
            throw new \InvalidArgumentException(sprintf('The paycheckJournalEmployeeTax property can only contain items of type \StructType\PaycheckJournalEmployeeTax, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->paycheckJournalEmployeeTax[] = $item;
        return $this;
    }
    /**
     * Get replaceAll value
     * @return bool|null
     */
    public function getReplaceAll()
    {
        return $this->replaceAll;
    }
    /**
     * Set replaceAll value
     * @param bool $replaceAll
     * @return \StructType\PaycheckJournalEmployeeTaxList
     */
    public function setReplaceAll($replaceAll = true)
    {
        // validation for constraint: boolean
        if (!is_null($replaceAll) && !is_bool($replaceAll)) {
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($replaceAll, true), gettype($replaceAll)), __LINE__);
        }
        $this->replaceAll = $replaceAll;
        return $this;
    }
}
