Neos\FluidAdaptor\Core\ViewHelper\AbstractViewHelper::getRenderMethodArgumentDefinitions PHP Метод

getRenderMethodArgumentDefinitions() публичный статический Метод

public static getRenderMethodArgumentDefinitions ( Neos\Flow\ObjectManagement\ObjectManagerInterface $objectManager ) : ArgumentDefinition[]
$objectManager Neos\Flow\ObjectManagement\ObjectManagerInterface
Результат ArgumentDefinition[]
    public static function getRenderMethodArgumentDefinitions(ObjectManagerInterface $objectManager)
    {
        $methodArgumentDefinitions = [];
        $reflectionService = $objectManager->get(ReflectionService::class);
        $methodParameters = $reflectionService->getMethodParameters(static::class, 'render');
        if (count($methodParameters) === 0) {
            return $methodArgumentDefinitions;
        }
        $methodTags = $reflectionService->getMethodTagsValues(static::class, 'render');
        $paramAnnotations = [];
        if (isset($methodTags['param'])) {
            $paramAnnotations = $methodTags['param'];
        }
        $i = 0;
        foreach ($methodParameters as $parameterName => $parameterInfo) {
            $dataType = null;
            if (isset($parameterInfo['type'])) {
                $dataType = isset($parameterInfo['array']) && (bool) $parameterInfo['array'] ? 'array' : $parameterInfo['type'];
            } else {
                throw new \Neos\FluidAdaptor\Core\Exception('Could not determine type of argument "' . $parameterName . '" of the render-method in ViewHelper "' . static::class . '". Either the methods docComment is invalid or some PHP optimizer strips off comments.', 1242292003);
            }
            $description = '';
            if (isset($paramAnnotations[$i])) {
                $explodedAnnotation = explode(' ', $paramAnnotations[$i]);
                array_shift($explodedAnnotation);
                array_shift($explodedAnnotation);
                $description = implode(' ', $explodedAnnotation);
            }
            $defaultValue = null;
            if (isset($parameterInfo['defaultValue'])) {
                $defaultValue = $parameterInfo['defaultValue'];
            }
            $methodArgumentDefinitions[$parameterName] = [$parameterName, $dataType, $description, $parameterInfo['optional'] === false, $defaultValue, true];
            $i++;
        }
        return $methodArgumentDefinitions;
    }