<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for EmployeeHrEducationList StructType
 * @subpackage Structs
 */
class EmployeeHrEducationList extends AbstractStructBase
{
    /**
     * The employeeHrEducation
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\EmployeeHrEducation[]
     */
    public $employeeHrEducation;
    /**
     * The replaceAll
     * Meta information extracted from the WSDL
     * - default: true
     * @var bool
     */
    public $replaceAll;
    /**
     * Constructor method for EmployeeHrEducationList
     * @uses EmployeeHrEducationList::setEmployeeHrEducation()
     * @uses EmployeeHrEducationList::setReplaceAll()
     * @param \StructType\EmployeeHrEducation[] $employeeHrEducation
     * @param bool $replaceAll
     */
    public function __construct(array $employeeHrEducation = array(), $replaceAll = true)
    {
        $this
            ->setEmployeeHrEducation($employeeHrEducation)
            ->setReplaceAll($replaceAll);
    }
    /**
     * Get employeeHrEducation value
     * @return \StructType\EmployeeHrEducation[]|null
     */
    public function getEmployeeHrEducation()
    {
        return $this->employeeHrEducation;
    }
    /**
     * This method is responsible for validating the values passed to the setEmployeeHrEducation method
     * This method is willingly generated in order to preserve the one-line inline validation within the setEmployeeHrEducation method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateEmployeeHrEducationForArrayConstraintsFromSetEmployeeHrEducation(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $employeeHrEducationListEmployeeHrEducationItem) {
            // validation for constraint: itemType
            if (!$employeeHrEducationListEmployeeHrEducationItem instanceof \StructType\EmployeeHrEducation) {
                $invalidValues[] = is_object($employeeHrEducationListEmployeeHrEducationItem) ? get_class($employeeHrEducationListEmployeeHrEducationItem) : sprintf('%s(%s)', gettype($employeeHrEducationListEmployeeHrEducationItem), var_export($employeeHrEducationListEmployeeHrEducationItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The employeeHrEducation property can only contain items of type \StructType\EmployeeHrEducation, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set employeeHrEducation value
     * @throws \InvalidArgumentException
     * @param \StructType\EmployeeHrEducation[] $employeeHrEducation
     * @return \StructType\EmployeeHrEducationList
     */
    public function setEmployeeHrEducation(array $employeeHrEducation = array())
    {
        // validation for constraint: array
        if ('' !== ($employeeHrEducationArrayErrorMessage = self::validateEmployeeHrEducationForArrayConstraintsFromSetEmployeeHrEducation($employeeHrEducation))) {
            throw new \InvalidArgumentException($employeeHrEducationArrayErrorMessage, __LINE__);
        }
        $this->employeeHrEducation = $employeeHrEducation;
        return $this;
    }
    /**
     * Add item to employeeHrEducation value
     * @throws \InvalidArgumentException
     * @param \StructType\EmployeeHrEducation $item
     * @return \StructType\EmployeeHrEducationList
     */
    public function addToEmployeeHrEducation(\StructType\EmployeeHrEducation $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\EmployeeHrEducation) {
            throw new \InvalidArgumentException(sprintf('The employeeHrEducation property can only contain items of type \StructType\EmployeeHrEducation, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->employeeHrEducation[] = $item;
        return $this;
    }
    /**
     * Get replaceAll value
     * @return bool|null
     */
    public function getReplaceAll()
    {
        return $this->replaceAll;
    }
    /**
     * Set replaceAll value
     * @param bool $replaceAll
     * @return \StructType\EmployeeHrEducationList
     */
    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;
    }
}
