<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Project_Worker_Role_Response_DataType StructType
 * Meta information extracted from the WSDL
 * - documentation: Wrapper Element that includes Project Worker Role Instance and Data
 * @subpackage Structs
 */
class Project_Worker_Role_Response_DataType extends AbstractStructBase
{
    /**
     * The Project_Worker_Role
     * Meta information extracted from the WSDL
     * - documentation: Project Worker Role
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Project_Worker_RoleType[]
     */
    public $Project_Worker_Role;
    /**
     * Constructor method for Project_Worker_Role_Response_DataType
     * @uses Project_Worker_Role_Response_DataType::setProject_Worker_Role()
     * @param \StructType\Project_Worker_RoleType[] $project_Worker_Role
     */
    public function __construct(array $project_Worker_Role = array())
    {
        $this
            ->setProject_Worker_Role($project_Worker_Role);
    }
    /**
     * Get Project_Worker_Role value
     * @return \StructType\Project_Worker_RoleType[]|null
     */
    public function getProject_Worker_Role()
    {
        return $this->Project_Worker_Role;
    }
    /**
     * This method is responsible for validating the values passed to the setProject_Worker_Role method
     * This method is willingly generated in order to preserve the one-line inline validation within the setProject_Worker_Role method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateProject_Worker_RoleForArrayConstraintsFromSetProject_Worker_Role(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $project_Worker_Role_Response_DataTypeProject_Worker_RoleItem) {
            // validation for constraint: itemType
            if (!$project_Worker_Role_Response_DataTypeProject_Worker_RoleItem instanceof \StructType\Project_Worker_RoleType) {
                $invalidValues[] = is_object($project_Worker_Role_Response_DataTypeProject_Worker_RoleItem) ? get_class($project_Worker_Role_Response_DataTypeProject_Worker_RoleItem) : sprintf('%s(%s)', gettype($project_Worker_Role_Response_DataTypeProject_Worker_RoleItem), var_export($project_Worker_Role_Response_DataTypeProject_Worker_RoleItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Project_Worker_Role property can only contain items of type \StructType\Project_Worker_RoleType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Project_Worker_Role value
     * @throws \InvalidArgumentException
     * @param \StructType\Project_Worker_RoleType[] $project_Worker_Role
     * @return \StructType\Project_Worker_Role_Response_DataType
     */
    public function setProject_Worker_Role(array $project_Worker_Role = array())
    {
        // validation for constraint: array
        if ('' !== ($project_Worker_RoleArrayErrorMessage = self::validateProject_Worker_RoleForArrayConstraintsFromSetProject_Worker_Role($project_Worker_Role))) {
            throw new \InvalidArgumentException($project_Worker_RoleArrayErrorMessage, __LINE__);
        }
        $this->Project_Worker_Role = $project_Worker_Role;
        return $this;
    }
    /**
     * Add item to Project_Worker_Role value
     * @throws \InvalidArgumentException
     * @param \StructType\Project_Worker_RoleType $item
     * @return \StructType\Project_Worker_Role_Response_DataType
     */
    public function addToProject_Worker_Role(\StructType\Project_Worker_RoleType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Project_Worker_RoleType) {
            throw new \InvalidArgumentException(sprintf('The Project_Worker_Role property can only contain items of type \StructType\Project_Worker_RoleType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Project_Worker_Role[] = $item;
        return $this;
    }
}
