Neos\Flow\Aop\Builder\AbstractMethodInterceptorBuilder::buildMethodArgumentsArrayCode PHP Метод

buildMethodArgumentsArrayCode() защищенный Метод

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.
protected buildMethodArgumentsArrayCode ( string $className, string $methodName, boolean $useArgumentsArray = false ) : string
$className string Name of the declaring class of the method
$methodName string Name of the method to create arguments array code for
$useArgumentsArray boolean If set, the $methodArguments array will be built from $arguments instead of using the actual parameter variables.
Результат string The generated code to be used in an "array()" definition
    protected function buildMethodArgumentsArrayCode($className, $methodName, $useArgumentsArray = false)
    {
        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;
    }