<?php

namespace ArrayType;

use \WsdlToPhp\PackageBase\AbstractStructArrayBase;

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