<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for StopPlaceRefsStructure StructType
 * Meta informations extracted from the WSDL
 * - documentation: Type for a collection of one or more references to a STOP PLACE.
 * @subpackage Structs
 */
class StopPlaceRefsStructure extends AbstractStructBase
{
    /**
     * The StopPlaceRef
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * - ref: StopPlaceRef
     * @var \StructType\StopPlaceRefStructure[]
     */
    public $StopPlaceRef;
    /**
     * Constructor method for StopPlaceRefsStructure
     * @uses StopPlaceRefsStructure::setStopPlaceRef()
     * @param \StructType\StopPlaceRefStructure[] $stopPlaceRef
     */
    public function __construct(array $stopPlaceRef = array())
    {
        $this
            ->setStopPlaceRef($stopPlaceRef);
    }
    /**
     * Get StopPlaceRef value
     * @return \StructType\StopPlaceRefStructure[]|null
     */
    public function getStopPlaceRef()
    {
        return $this->StopPlaceRef;
    }
    /**
     * Set StopPlaceRef value
     * @throws \InvalidArgumentException
     * @param \StructType\StopPlaceRefStructure[] $stopPlaceRef
     * @return \StructType\StopPlaceRefsStructure
     */
    public function setStopPlaceRef(array $stopPlaceRef = array())
    {
        foreach ($stopPlaceRef as $stopPlaceRefsStructureStopPlaceRefItem) {
            // validation for constraint: itemType
            if (!$stopPlaceRefsStructureStopPlaceRefItem instanceof \StructType\StopPlaceRefStructure) {
                throw new \InvalidArgumentException(sprintf('The StopPlaceRef property can only contain items of \StructType\StopPlaceRefStructure, "%s" given', is_object($stopPlaceRefsStructureStopPlaceRefItem) ? get_class($stopPlaceRefsStructureStopPlaceRefItem) : gettype($stopPlaceRefsStructureStopPlaceRefItem)), __LINE__);
            }
        }
        $this->StopPlaceRef = $stopPlaceRef;
        return $this;
    }
    /**
     * Add item to StopPlaceRef value
     * @throws \InvalidArgumentException
     * @param \StructType\StopPlaceRefStructure $item
     * @return \StructType\StopPlaceRefsStructure
     */
    public function addToStopPlaceRef(\StructType\StopPlaceRefStructure $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\StopPlaceRefStructure) {
            throw new \InvalidArgumentException(sprintf('The StopPlaceRef property can only contain items of \StructType\StopPlaceRefStructure, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->StopPlaceRef[] = $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\StopPlaceRefsStructure
     */
    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__;
    }
}
