<?php

namespace patest\ArrayType;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

/**
 * This class stands for ArrayOfTicketing.SeriesOrSeriesGroup ArrayType
 * Meta information extracted from the WSDL
 * - nillable: true
 * - type: tns:ArrayOfTicketing.SeriesOrSeriesGroup
 * @subpackage Arrays
 */
class ArrayOfTicketing_SeriesOrSeriesGroup extends AbstractStructArrayBase
{
    /**
     * The Ticketing_SeriesOrSeriesGroup
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * - nillable: true
     * @var \patest\StructType\Ticketing_SeriesOrSeriesGroup[]
     */
    public $Ticketing_SeriesOrSeriesGroup;
    /**
     * Constructor method for ArrayOfTicketing.SeriesOrSeriesGroup
     * @uses ArrayOfTicketing_SeriesOrSeriesGroup::setTicketing_SeriesOrSeriesGroup()
     * @param \patest\StructType\Ticketing_SeriesOrSeriesGroup[] $ticketing_SeriesOrSeriesGroup
     */
    public function __construct(array $ticketing_SeriesOrSeriesGroup = array())
    {
        $this
            ->setTicketing_SeriesOrSeriesGroup($ticketing_SeriesOrSeriesGroup);
    }
    /**
     * Get Ticketing_SeriesOrSeriesGroup value
     * An additional test has been added (isset) before returning the property value as
     * this property may have been unset before, due to the fact that this property is
     * removable from the request (nillable=true+minOccurs=0)
     * @return \patest\StructType\Ticketing_SeriesOrSeriesGroup[]|null
     */
    public function getTicketing_SeriesOrSeriesGroup()
    {
        return isset($this->{'Ticketing.SeriesOrSeriesGroup'}) ? $this->{'Ticketing.SeriesOrSeriesGroup'} : null;
    }
    /**
     * This method is responsible for validating the values passed to the setTicketing_SeriesOrSeriesGroup method
     * This method is willingly generated in order to preserve the one-line inline validation within the setTicketing_SeriesOrSeriesGroup method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateTicketing_SeriesOrSeriesGroupForArrayConstraintsFromSetTicketing_SeriesOrSeriesGroup(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $arrayOfTicketing_SeriesOrSeriesGroupTicketing_SeriesOrSeriesGroupItem) {
            // validation for constraint: itemType
            if (!$arrayOfTicketing_SeriesOrSeriesGroupTicketing_SeriesOrSeriesGroupItem instanceof \patest\StructType\Ticketing_SeriesOrSeriesGroup) {
                $invalidValues[] = is_object($arrayOfTicketing_SeriesOrSeriesGroupTicketing_SeriesOrSeriesGroupItem) ? get_class($arrayOfTicketing_SeriesOrSeriesGroupTicketing_SeriesOrSeriesGroupItem) : sprintf('%s(%s)', gettype($arrayOfTicketing_SeriesOrSeriesGroupTicketing_SeriesOrSeriesGroupItem), var_export($arrayOfTicketing_SeriesOrSeriesGroupTicketing_SeriesOrSeriesGroupItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The Ticketing_SeriesOrSeriesGroup property can only contain items of type \patest\StructType\Ticketing_SeriesOrSeriesGroup, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set Ticketing_SeriesOrSeriesGroup value
     * This property is removable from request (nillable=true+minOccurs=0), therefore
     * if the value assigned to this property is null, it is removed from this object
     * @throws \InvalidArgumentException
     * @param \patest\StructType\Ticketing_SeriesOrSeriesGroup[] $ticketing_SeriesOrSeriesGroup
     * @return \patest\ArrayType\ArrayOfTicketing_SeriesOrSeriesGroup
     */
    public function setTicketing_SeriesOrSeriesGroup(array $ticketing_SeriesOrSeriesGroup = array())
    {
        // validation for constraint: array
        if ('' !== ($ticketing_SeriesOrSeriesGroupArrayErrorMessage = self::validateTicketing_SeriesOrSeriesGroupForArrayConstraintsFromSetTicketing_SeriesOrSeriesGroup($ticketing_SeriesOrSeriesGroup))) {
            throw new \InvalidArgumentException($ticketing_SeriesOrSeriesGroupArrayErrorMessage, __LINE__);
        }
        if (is_null($ticketing_SeriesOrSeriesGroup) || (is_array($ticketing_SeriesOrSeriesGroup) && empty($ticketing_SeriesOrSeriesGroup))) {
            unset($this->Ticketing_SeriesOrSeriesGroup, $this->{'Ticketing.SeriesOrSeriesGroup'});
        } else {
            $this->Ticketing_SeriesOrSeriesGroup = $this->{'Ticketing.SeriesOrSeriesGroup'} = $ticketing_SeriesOrSeriesGroup;
        }
        return $this;
    }
    /**
     * Add item to Ticketing_SeriesOrSeriesGroup value
     * @throws \InvalidArgumentException
     * @param \patest\StructType\Ticketing_SeriesOrSeriesGroup $item
     * @return \patest\ArrayType\ArrayOfTicketing_SeriesOrSeriesGroup
     */
    public function addToTicketing_SeriesOrSeriesGroup(\patest\StructType\Ticketing_SeriesOrSeriesGroup $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \patest\StructType\Ticketing_SeriesOrSeriesGroup) {
            throw new \InvalidArgumentException(sprintf('The Ticketing_SeriesOrSeriesGroup property can only contain items of type \patest\StructType\Ticketing_SeriesOrSeriesGroup, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->Ticketing_SeriesOrSeriesGroup[] = $this->{'Ticketing.SeriesOrSeriesGroup'}[] = $item;
        return $this;
    }
    /**
     * Returns the current element
     * @see AbstractStructArrayBase::current()
     * @return \patest\StructType\Ticketing_SeriesOrSeriesGroup|null
     */
    public function current()
    {
        return parent::current();
    }
    /**
     * Returns the indexed element
     * @see AbstractStructArrayBase::item()
     * @param int $index
     * @return \patest\StructType\Ticketing_SeriesOrSeriesGroup|null
     */
    public function item($index)
    {
        return parent::item($index);
    }
    /**
     * Returns the first element
     * @see AbstractStructArrayBase::first()
     * @return \patest\StructType\Ticketing_SeriesOrSeriesGroup|null
     */
    public function first()
    {
        return parent::first();
    }
    /**
     * Returns the last element
     * @see AbstractStructArrayBase::last()
     * @return \patest\StructType\Ticketing_SeriesOrSeriesGroup|null
     */
    public function last()
    {
        return parent::last();
    }
    /**
     * Returns the element at the offset
     * @see AbstractStructArrayBase::offsetGet()
     * @param int $offset
     * @return \patest\StructType\Ticketing_SeriesOrSeriesGroup|null
     */
    public function offsetGet($offset)
    {
        return parent::offsetGet($offset);
    }
    /**
     * Returns the attribute name
     * @see AbstractStructArrayBase::getAttributeName()
     * @return string Ticketing.SeriesOrSeriesGroup
     */
    public function getAttributeName()
    {
        return 'Ticketing.SeriesOrSeriesGroup';
    }
}
