<?php

namespace dgsoft\StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

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