<?php

namespace ArrayType;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

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