private function addItem($methodName, array $methodArguments)
{
$parameterClass = substr($methodName, 3);
$fullParameterClass = $this->getFullParameterClass($parameterClass, $methodName);
if (!isset($methodArguments[0])) {
throw new \InvalidArgumentException('You must specify a ' . $parameterClass . ' to be add for ' . $methodName);
} else {
$parameterObject = new $fullParameterClass($methodArguments[0]);
}
$collectionIndex = $this->getIndexFromArguments($methodArguments);
if (isset($this->compoundParametersCollections[$parameterClass . $collectionIndex])) {
$this->compoundParametersCollections[$parameterClass . $collectionIndex]->add($parameterObject);
} else {
$fullParameterCollectionClass = $fullParameterClass . 'Collection';
/** @var CompoundParameterCollection $parameterObjectCollection */
$parameterObjectCollection = new $fullParameterCollectionClass($collectionIndex);
$parameterObjectCollection->add($parameterObject);
$this->compoundParametersCollections[$parameterClass . $collectionIndex] = $parameterObjectCollection;
}
return $this;
}