<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for AffectedComponents StructType
 * Meta informations extracted from the WSDL
 * - documentation: Quays affected by SITUATION.
 * @subpackage Structs
 */
class AffectedComponents extends AbstractStructBase
{
    /**
     * The AffectedComponent
     * Meta informations extracted from the WSDL
     * - documentation: Quay affected by SITUATION.
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\AffectedStopPlaceComponentStructure[]
     */
    public $AffectedComponent;
    /**
     * Constructor method for AffectedComponents
     * @uses AffectedComponents::setAffectedComponent()
     * @param \StructType\AffectedStopPlaceComponentStructure[] $affectedComponent
     */
    public function __construct(array $affectedComponent = array())
    {
        $this
            ->setAffectedComponent($affectedComponent);
    }
    /**
     * Get AffectedComponent value
     * @return \StructType\AffectedStopPlaceComponentStructure[]|null
     */
    public function getAffectedComponent()
    {
        return $this->AffectedComponent;
    }
    /**
     * Set AffectedComponent value
     * @throws \InvalidArgumentException
     * @param \StructType\AffectedStopPlaceComponentStructure[] $affectedComponent
     * @return \StructType\AffectedComponents
     */
    public function setAffectedComponent(array $affectedComponent = array())
    {
        foreach ($affectedComponent as $affectedComponentsAffectedComponentItem) {
            // validation for constraint: itemType
            if (!$affectedComponentsAffectedComponentItem instanceof \StructType\AffectedStopPlaceComponentStructure) {
                throw new \InvalidArgumentException(sprintf('The AffectedComponent property can only contain items of \StructType\AffectedStopPlaceComponentStructure, "%s" given', is_object($affectedComponentsAffectedComponentItem) ? get_class($affectedComponentsAffectedComponentItem) : gettype($affectedComponentsAffectedComponentItem)), __LINE__);
            }
        }
        $this->AffectedComponent = $affectedComponent;
        return $this;
    }
    /**
     * Add item to AffectedComponent value
     * @throws \InvalidArgumentException
     * @param \StructType\AffectedStopPlaceComponentStructure $item
     * @return \StructType\AffectedComponents
     */
    public function addToAffectedComponent(\StructType\AffectedStopPlaceComponentStructure $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\AffectedStopPlaceComponentStructure) {
            throw new \InvalidArgumentException(sprintf('The AffectedComponent property can only contain items of \StructType\AffectedStopPlaceComponentStructure, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->AffectedComponent[] = $item;
        return $this;
    }
    /**
     * Method called when an object has been exported with var_export() functions
     * It allows to return an object instantiated with the values
     * @see AbstractStructBase::__set_state()
     * @uses AbstractStructBase::__set_state()
     * @param array $array the exported values
     * @return \StructType\AffectedComponents
     */
    public static function __set_state(array $array)
    {
        return parent::__set_state($array);
    }
    /**
     * Method returning the class name
     * @return string __CLASS__
     */
    public function __toString()
    {
        return __CLASS__;
    }
}
