<?php

namespace dgsoft\StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for AncillaryServiceFeesType StructType
 * @package Dg
 * @subpackage Structs
 */
class DgAncillaryServiceFeesType extends AbstractStructBase
{
    /**
     * The ServiceFee
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \dgsoft\StructType\DgAncillaryServiceFeeType[]
     */
    public $ServiceFee;
    /**
     * Constructor method for AncillaryServiceFeesType
     * @uses DgAncillaryServiceFeesType::setServiceFee()
     * @param \dgsoft\StructType\DgAncillaryServiceFeeType[] $serviceFee
     */
    public function __construct(array $serviceFee = array())
    {
        $this
            ->setServiceFee($serviceFee);
    }
    /**
     * Get ServiceFee value
     * @return \dgsoft\StructType\DgAncillaryServiceFeeType[]|null
     */
    public function getServiceFee()
    {
        return $this->ServiceFee;
    }
    /**
     * Set ServiceFee value
     * @throws \InvalidArgumentException
     * @param \dgsoft\StructType\DgAncillaryServiceFeeType[] $serviceFee
     * @return \dgsoft\StructType\DgAncillaryServiceFeesType
     */
    public function setServiceFee(array $serviceFee = array())
    {
        foreach ($serviceFee as $ancillaryServiceFeesTypeServiceFeeItem) {
            // validation for constraint: itemType
            if (!$ancillaryServiceFeesTypeServiceFeeItem instanceof \dgsoft\StructType\DgAncillaryServiceFeeType) {
                throw new \InvalidArgumentException(sprintf('The ServiceFee property can only contain items of \dgsoft\StructType\DgAncillaryServiceFeeType, "%s" given', is_object($ancillaryServiceFeesTypeServiceFeeItem) ? get_class($ancillaryServiceFeesTypeServiceFeeItem) : gettype($ancillaryServiceFeesTypeServiceFeeItem)), __LINE__);
            }
        }
        $this->ServiceFee = $serviceFee;
        return $this;
    }
    /**
     * Add item to ServiceFee value
     * @throws \InvalidArgumentException
     * @param \dgsoft\StructType\DgAncillaryServiceFeeType $item
     * @return \dgsoft\StructType\DgAncillaryServiceFeesType
     */
    public function addToServiceFee(\dgsoft\StructType\DgAncillaryServiceFeeType $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \dgsoft\StructType\DgAncillaryServiceFeeType) {
            throw new \InvalidArgumentException(sprintf('The ServiceFee property can only contain items of \dgsoft\StructType\DgAncillaryServiceFeeType, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->ServiceFee[] = $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 \dgsoft\StructType\DgAncillaryServiceFeesType
     */
    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__;
    }
}
