<?php

namespace SelectSiparis;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

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