<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Project_Phase_Response_DataType StructType
 * Meta information extracted from the WSDL
 * - documentation: Element containing the data requested in the GET Project Plan web service request
 * @subpackage Structs
 */
class Project_Phase_Response_DataType extends AbstractStructBase
{
    /**
     * The Project_Phase
     * Meta information extracted from the WSDL
     * - documentation: Element wrapping all Project Phase information
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\Project_PhaseType[]
     */
    public $Project_Phase;
    /**
     * Constructor method for Project_Phase_Response_DataType
     * @uses Project_Phase_Response_DataType::setProject_Phase()
     * @param \StructType\Project_PhaseType[] $project_Phase
     */
    public function __construct(array $project_Phase = array())
    {
        $this
            ->setProject_Phase($project_Phase);
    }
    /**
     * Get Project_Phase value
     * @return \StructType\Project_PhaseType[]|null
     */
    public function getProject_Phase()
    {
        return $this->Project_Phase;
    }
    /**
     * This method is responsible for validating the values passed to the setProject_Phase method
     * This method is willingly generated in order to preserve the one-line inline validation within the setProject_Phase method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateProject_PhaseForArrayConstraintsFromSetProject_Phase(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $project_Phase_Response_DataTypeProject_PhaseItem) {
            // validation for constraint: itemType
            if (!$project_Phase_Response_DataTypeProject_PhaseItem instanceof \StructType\Project_PhaseType) {
                $invalidValues[] = is_object($project_Phase_Response_DataTypeProject_PhaseItem) ? get_class($project_Phase_Response_DataTypeProject_PhaseItem) : sprintf('%s(%s)', gettype($project_Phase_Response_DataTypeProject_PhaseItem), var_export($project_Phase_Response_DataTypeProject_PhaseItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Project_Phase property can only contain items of type \StructType\Project_PhaseType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Project_Phase value
     * @throws \InvalidArgumentException
     * @param \StructType\Project_PhaseType[] $project_Phase
     * @return \StructType\Project_Phase_Response_DataType
     */
    public function setProject_Phase(array $project_Phase = array())
    {
        // validation for constraint: array
        if ('' !== ($project_PhaseArrayErrorMessage = self::validateProject_PhaseForArrayConstraintsFromSetProject_Phase($project_Phase))) {
            throw new \InvalidArgumentException($project_PhaseArrayErrorMessage, __LINE__);
        }
        $this->Project_Phase = $project_Phase;
        return $this;
    }
    /**
     * Add item to Project_Phase value
     * @throws \InvalidArgumentException
     * @param \StructType\Project_PhaseType $item
     * @return \StructType\Project_Phase_Response_DataType
     */
    public function addToProject_Phase(\StructType\Project_PhaseType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\Project_PhaseType) {
            throw new \InvalidArgumentException(sprintf('The Project_Phase property can only contain items of type \StructType\Project_PhaseType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Project_Phase[] = $item;
        return $this;
    }
}
