<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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