<?php
use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

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