<?php
use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

/**
 * This class stands for ArrayOfGruppoTurni ArrayType
 * Meta information extracted from the WSDL
 * - nillable: true
 * - type: tns:ArrayOfGruppoTurni
 * @subpackage Arrays
 */
class ArrayOfGruppoTurni extends AbstractStructArrayBase
{
    /**
     * The GruppoTurni
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var GruppoTurni[]
     */
    public $GruppoTurni;
    /**
     * Constructor method for ArrayOfGruppoTurni
     * @uses ArrayOfGruppoTurni::setGruppoTurni()
     * @param GruppoTurni[] $gruppoTurni
     */
    public function __construct(array $gruppoTurni = array())
    {
        $this
            ->setGruppoTurni($gruppoTurni);
    }
    /**
     * Get GruppoTurni value
     * @return GruppoTurni[]|null
     */
    public function getGruppoTurni()
    {
        return $this->GruppoTurni;
    }
    /**
     * This method is responsible for validating the values passed to the setGruppoTurni method
     * This method is willingly generated in order to preserve the one-line inline validation within the setGruppoTurni method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateGruppoTurniForArrayConstraintsFromSetGruppoTurni(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $arrayOfGruppoTurniGruppoTurniItem) {
            // validation for constraint: itemType
            if (!$arrayOfGruppoTurniGruppoTurniItem instanceof GruppoTurni) {
                $invalidValues[] = is_object($arrayOfGruppoTurniGruppoTurniItem) ? get_class($arrayOfGruppoTurniGruppoTurniItem) : sprintf('%s(%s)', gettype($arrayOfGruppoTurniGruppoTurniItem), var_export($arrayOfGruppoTurniGruppoTurniItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The GruppoTurni property can only contain items of type GruppoTurni, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set GruppoTurni value
     * @throws \InvalidArgumentException
     * @param GruppoTurni[] $gruppoTurni
     * @return ArrayOfGruppoTurni
     */
    public function setGruppoTurni(array $gruppoTurni = array())
    {
        // validation for constraint: array
        if ('' !== ($gruppoTurniArrayErrorMessage = self::validateGruppoTurniForArrayConstraintsFromSetGruppoTurni($gruppoTurni))) {
            throw new \InvalidArgumentException($gruppoTurniArrayErrorMessage, __LINE__);
        }
        $this->GruppoTurni = $gruppoTurni;
        return $this;
    }
    /**
     * Add item to GruppoTurni value
     * @throws \InvalidArgumentException
     * @param GruppoTurni $item
     * @return ArrayOfGruppoTurni
     */
    public function addToGruppoTurni(GruppoTurni $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof GruppoTurni) {
            throw new \InvalidArgumentException(sprintf('The GruppoTurni property can only contain items of type GruppoTurni, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->GruppoTurni[] = $item;
        return $this;
    }
    /**
     * Returns the current element
     * @see AbstractStructArrayBase::current()
     * @return GruppoTurni|null
     */
    public function current()
    {
        return parent::current();
    }
    /**
     * Returns the indexed element
     * @see AbstractStructArrayBase::item()
     * @param int $index
     * @return GruppoTurni|null
     */
    public function item($index)
    {
        return parent::item($index);
    }
    /**
     * Returns the first element
     * @see AbstractStructArrayBase::first()
     * @return GruppoTurni|null
     */
    public function first()
    {
        return parent::first();
    }
    /**
     * Returns the last element
     * @see AbstractStructArrayBase::last()
     * @return GruppoTurni|null
     */
    public function last()
    {
        return parent::last();
    }
    /**
     * Returns the element at the offset
     * @see AbstractStructArrayBase::offsetGet()
     * @param int $offset
     * @return GruppoTurni|null
     */
    public function offsetGet($offset)
    {
        return parent::offsetGet($offset);
    }
    /**
     * Returns the attribute name
     * @see AbstractStructArrayBase::getAttributeName()
     * @return string GruppoTurni
     */
    public function getAttributeName()
    {
        return 'GruppoTurni';
    }
}
