<?php

namespace ArrayType;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

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