<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for TpegNamedOnlyArea StructType
 * @subpackage Structs
 */
class TpegNamedOnlyArea extends TpegAreaLocation
{
    /**
     * The name
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * @var \StructType\TpegAreaDescriptor[]
     */
    public $name;
    /**
     * The tpegNamedOnlyAreaExtension
     * Meta informations extracted from the WSDL
     * - minOccurs: 0
     * @var \StructType\ExtensionType
     */
    public $tpegNamedOnlyAreaExtension;
    /**
     * Constructor method for TpegNamedOnlyArea
     * @uses TpegNamedOnlyArea::setName()
     * @uses TpegNamedOnlyArea::setTpegNamedOnlyAreaExtension()
     * @param \StructType\TpegAreaDescriptor[] $name
     * @param \StructType\ExtensionType $tpegNamedOnlyAreaExtension
     */
    public function __construct(array $name = array(), \StructType\ExtensionType $tpegNamedOnlyAreaExtension = null)
    {
        $this
            ->setName($name)
            ->setTpegNamedOnlyAreaExtension($tpegNamedOnlyAreaExtension);
    }
    /**
     * Get name value
     * @return \StructType\TpegAreaDescriptor[]|null
     */
    public function getName()
    {
        return $this->name;
    }
    /**
     * Set name value
     * @throws \InvalidArgumentException
     * @param \StructType\TpegAreaDescriptor[] $name
     * @return \StructType\TpegNamedOnlyArea
     */
    public function setName(array $name = array())
    {
        foreach ($name as $tpegNamedOnlyAreaNameItem) {
            // validation for constraint: itemType
            if (!$tpegNamedOnlyAreaNameItem instanceof \StructType\TpegAreaDescriptor) {
                throw new \InvalidArgumentException(sprintf('The name property can only contain items of \StructType\TpegAreaDescriptor, "%s" given', is_object($tpegNamedOnlyAreaNameItem) ? get_class($tpegNamedOnlyAreaNameItem) : gettype($tpegNamedOnlyAreaNameItem)), __LINE__);
            }
        }
        $this->name = $name;
        return $this;
    }
    /**
     * Add item to name value
     * @throws \InvalidArgumentException
     * @param \StructType\TpegAreaDescriptor $item
     * @return \StructType\TpegNamedOnlyArea
     */
    public function addToName(\StructType\TpegAreaDescriptor $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\TpegAreaDescriptor) {
            throw new \InvalidArgumentException(sprintf('The name property can only contain items of \StructType\TpegAreaDescriptor, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->name[] = $item;
        return $this;
    }
    /**
     * Get tpegNamedOnlyAreaExtension value
     * @return \StructType\ExtensionType|null
     */
    public function getTpegNamedOnlyAreaExtension()
    {
        return $this->tpegNamedOnlyAreaExtension;
    }
    /**
     * Set tpegNamedOnlyAreaExtension value
     * @param \StructType\ExtensionType $tpegNamedOnlyAreaExtension
     * @return \StructType\TpegNamedOnlyArea
     */
    public function setTpegNamedOnlyAreaExtension(\StructType\ExtensionType $tpegNamedOnlyAreaExtension = null)
    {
        $this->tpegNamedOnlyAreaExtension = $tpegNamedOnlyAreaExtension;
        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\TpegNamedOnlyArea
     */
    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__;
    }
}
