<?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for removePatterns StructType
 * @subpackage Structs
 */
class RemovePatterns extends XCommonMembersExtension
{
    /**
     * The pattern
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 1
     * @var XPatternMember[]
     */
    public $pattern;
    /**
     * Constructor method for removePatterns
     * @uses RemovePatterns::setPattern()
     * @param XPatternMember[] $pattern
     */
    public function __construct(array $pattern = array())
    {
        $this
            ->setPattern($pattern);
    }
    /**
     * Get pattern value
     * @return XPatternMember[]
     */
    public function getPattern()
    {
        return $this->pattern;
    }
    /**
     * Set pattern value
     * @throws \InvalidArgumentException
     * @param XPatternMember[] $pattern
     * @return RemovePatterns
     */
    public function setPattern(array $pattern = array())
    {
        foreach ($pattern as $removePatternsPatternItem) {
            // validation for constraint: itemType
            if (!$removePatternsPatternItem instanceof XPatternMember) {
                throw new \InvalidArgumentException(sprintf('The pattern property can only contain items of XPatternMember, "%s" given', is_object($removePatternsPatternItem) ? get_class($removePatternsPatternItem) : gettype($removePatternsPatternItem)), __LINE__);
            }
        }
        $this->pattern = $pattern;
        return $this;
    }
    /**
     * Add item to pattern value
     * @throws \InvalidArgumentException
     * @param XPatternMember $item
     * @return RemovePatterns
     */
    public function addToPattern(XPatternMember $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof XPatternMember) {
            throw new \InvalidArgumentException(sprintf('The pattern property can only contain items of XPatternMember, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->pattern[] = $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 RemovePatterns
     */
    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__;
    }
}
