protected function buildMethodArgumentsArrayCode(string $className = null, string $methodName = null, bool $useArgumentsArray = false): string
    {
        if ($className === null || $methodName === null) {
            return '';
        }

        $argumentsArrayCode = "\n                \$methodArguments = [];\n";

        $methodParameters = $this->reflectionService->getMethodParameters($className, $methodName);
        if (count($methodParameters) > 0) {
            $argumentsArrayCode .= "\n";
            $argumentIndex = 0;
            foreach ($methodParameters as $methodParameterName => $methodParameterInfo) {
                if ($useArgumentsArray) {
                    $argumentsArrayCode .= "                if (array_key_exists(" . $argumentIndex . ", \$arguments)) \$methodArguments['" . $methodParameterName . "'] = \$arguments[" . $argumentIndex . "];\n";
                } else {
                    $argumentsArrayCode .= "                \$methodArguments['" . $methodParameterName . "'] = ";
                    $argumentsArrayCode .= $methodParameterInfo['byReference'] ? '&' : '';
                    $argumentsArrayCode .= '$' . $methodParameterName . ";\n";
                }
                $argumentIndex ++;
            }
            $argumentsArrayCode .= "            ";
        }
        return $argumentsArrayCode;
    }
protected function buildMethodArgumentsArrayCode(string $className = null, string $methodName = null, bool $useArgumentsArray = false): string
    {
        if ($className === null || $methodName === null) {
            return '';
        }

        $argumentsArrayCode = "\n                \$methodArguments = [];\n";

        $methodParameters = $this->reflectionService->getMethodParameters($className, $methodName);
        if (count($methodParameters) > 0) {
            $argumentsArrayCode .= "\n";
            $argumentIndex = 0;
            foreach ($methodParameters as $methodParameterName => $methodParameterInfo) {
                if ($useArgumentsArray) {
                    $argumentsArrayCode .= "                if (array_key_exists(" . $argumentIndex . ", \$arguments)) \$methodArguments['" . $methodParameterName . "'] = \$arguments[" . $argumentIndex . "];\n";
                } else {
                    $argumentsArrayCode .= "                \$methodArguments['" . $methodParameterName . "'] = ";
                    $argumentsArrayCode .= $methodParameterInfo['byReference'] ? '&' : '';
                    $argumentsArrayCode .= '$' . $methodParameterName . ";\n";
                }
                $argumentIndex ++;
            }
            $argumentsArrayCode .= "            ";
        }
        return $argumentsArrayCode;
    }
protected function buildMethodArgumentsArrayCode ( string $ className = null , string $ methodName = null , bool $ useArgumentsArray = false ) : string { if ( $ className === null || $ methodName === null ) { return '' ; } $ argumentsArrayCode = "\n                \$methodArguments = [];\n" ; $ methodParameters = $ this -> reflectionService -> getMethodParameters ( $ className , $ methodName ) ; if ( count ( $ methodParameters ) > 0 ) { $ argumentsArrayCode .= "\n" ; $ argumentIndex = 0 ; foreach ( $ methodParameters as $ methodParameterName => $ methodParameterInfo ) { if ( $ useArgumentsArray ) { $ argumentsArrayCode .= "                if (array_key_exists(" . $ argumentIndex . ", \$arguments)) \$methodArguments['" . $ methodParameterName . "'] = \$arguments[" . $ argumentIndex . "];\n" ; } else { $ argumentsArrayCode .= "                \$methodArguments['" . $ methodParameterName . "'] = " ; $ argumentsArrayCode .= $ methodParameterInfo [ 'byReference' ] ? '&' : '' ; $ argumentsArrayCode .= '$' . $ methodParameterName . ";\n" ; } $ argumentIndex ++ ; } $ argumentsArrayCode .= "            " ; } return $ argumentsArrayCode ; }
Builds the PHP code for the method arguments array which is passed to
the constructor of a new join point. Used in the method interceptor
functions.

@param string $className Name of the declaring class of the method
@param string $methodName Name of the method to create arguments array code for
@param boolean $useArgumentsArray If set, the $methodArguments array will be built from $arguments instead of using the actual parameter variables.
@return string The generated code to be used in an "array()" definition
Builds the PHP code for the method arguments array which is passed to the constructor of a new join point . Used in the method interceptor functions .