<?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for lineAssociations StructType
 * Meta informations extracted from the WSDL
 * - documentation: The line association for this remote destination. The line to be associated must already be added to the remote destination profile. All directory numbers specified must already exist in the database. | The line association for this
 * remote destination. The line to be associated must already be added to the remote destination profile. All directory numbers specified must already exist in the database. | The line association for this remote destination. The line to be associated
 * must already be added to the remote destination profile. All directory numbers specified must already exist in the database.
 * @subpackage Structs
 */
class LineAssociations extends AbstractStructBase
{
    /**
     * The lineAssociation
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var XLineAssociation[]
     */
    public $lineAssociation;
    /**
     * Constructor method for lineAssociations
     * @uses LineAssociations::setLineAssociation()
     * @param XLineAssociation[] $lineAssociation
     */
    public function __construct(array $lineAssociation = array())
    {
        $this
            ->setLineAssociation($lineAssociation);
    }
    /**
     * Get lineAssociation value
     * @return XLineAssociation[]|null
     */
    public function getLineAssociation()
    {
        return $this->lineAssociation;
    }
    /**
     * Set lineAssociation value
     * @throws \InvalidArgumentException
     * @param XLineAssociation[] $lineAssociation
     * @return LineAssociations
     */
    public function setLineAssociation(array $lineAssociation = array())
    {
        foreach ($lineAssociation as $lineAssociationsLineAssociationItem) {
            // validation for constraint: itemType
            if (!$lineAssociationsLineAssociationItem instanceof XLineAssociation) {
                throw new \InvalidArgumentException(sprintf('The lineAssociation property can only contain items of XLineAssociation, "%s" given', is_object($lineAssociationsLineAssociationItem) ? get_class($lineAssociationsLineAssociationItem) : gettype($lineAssociationsLineAssociationItem)), __LINE__);
            }
        }
        $this->lineAssociation = $lineAssociation;
        return $this;
    }
    /**
     * Add item to lineAssociation value
     * @throws \InvalidArgumentException
     * @param XLineAssociation $item
     * @return LineAssociations
     */
    public function addToLineAssociation(XLineAssociation $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof XLineAssociation) {
            throw new \InvalidArgumentException(sprintf('The lineAssociation property can only contain items of XLineAssociation, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->lineAssociation[] = $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 LineAssociations
     */
    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__;
    }
}
