TheIconic\Tracking\GoogleAnalytics\Analytics::addItem PHP Method

addItem() private method

Adds an item to a compund parameter collection.
private addItem ( $methodName, array $methodArguments )
$methodName
$methodArguments array
    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;
    }