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

getParameter() private method

Gets the value for a parameter.
private getParameter ( $methodName, array $methodArguments ) : string
$methodName
$methodArguments array
return string
    private function getParameter($methodName, array $methodArguments)
    {
        $parameterClass = substr($methodName, 3);
        $fullParameterClass = $this->getFullParameterClass($parameterClass, $methodName);
        // Handle index arguments
        $parameterIndex = '';
        if (isset($methodArguments[0]) && is_numeric($methodArguments[0])) {
            $parameterIndex = $methodArguments[0];
        }
        // Handle compoundParametersCollections
        if (isset($this->compoundParametersCollections[$parameterClass . $parameterIndex])) {
            // If compoundParametersCollections contains our Objects, return them well-formatted
            return $this->compoundParametersCollections[$parameterClass . $parameterIndex]->getReadableItems();
        } else {
            $fullParameterCollectionClass = $fullParameterClass . 'Collection';
            // Test if the class Collection exist
            if (class_exists($fullParameterCollectionClass)) {
                return null;
            }
            // If not, it's a SingleParameter Object, continue the magic
        }
        /** @var SingleParameter $parameterObject */
        $parameterObject = new $fullParameterClass($parameterIndex);
        if (!array_key_exists($parameterObject->getName(), $this->singleParameters)) {
            return null;
        }
        $currentParameterObject = $this->singleParameters[$parameterObject->getName()];
        return $currentParameterObject->getValue();
    }