src/Traits/Indexable.php
protected function addIndex($string, $index)
    {
        if (empty($string)) {
            throw new InvalidNameException('Name attribute not defined for class ' . get_class($this));
        }

        if (strpos($string, $this->indexPlaceholder) !== false) {
            if (!is_numeric($index) || $index < $this->minIndex() || $index > $this->maxIndex()) {
                throw new InvalidIndexException(
                    'When setting parameter ' . get_class($this)
                    . ' a numeric index between 1 - 200 must be passed for the second argument'
                );
            }
        }

        return str_replace($this->indexPlaceholder, $index, $string);
    }
protected function addIndex($string, $index)
    {
        if (empty($string)) {
            throw new InvalidNameException('Name attribute not defined for class ' . get_class($this));
        }

        if (strpos($string, $this->indexPlaceholder) !== false) {
            if (!is_numeric($index) || $index < $this->minIndex() || $index > $this->maxIndex()) {
                throw new InvalidIndexException(
                    'When setting parameter ' . get_class($this)
                    . ' a numeric index between 1 - 200 must be passed for the second argument'
                );
            }
        }

        return str_replace($this->indexPlaceholder, $index, $string);
    }
Replaces a placeholder for the index passed.

@param string $string
@param int $index
@return string
@throws \TheIconic\Tracking\GoogleAnalytics\Exception\InvalidIndexException
@throws \TheIconic\Tracking\GoogleAnalytics\Exception\InvalidNameException