Programming Language PHP

Namespace Oro\Component\Layout\ExpressionLanguage

Class ClosureWithExtraParams

Total Examples 1

1 code examples of PHP Oro\Component\Layout\ExpressionLanguage\ClosureWithExtraParams extracted from open source projects

Was this example useful?
0
                                                    protected function processClosureWithExtraParams(
        ClosureWithExtraParams $value,
        ContextInterface $context,
        ?DataAccessorInterface $data,
        bool $evaluate,
        ?string $encoding
    ): mixed {
        if (!$this->visible) {
            return null;
        }

        $params = [];
        foreach ($value->getExtraParamNames() as $paramName) {
            if (!\array_key_exists($paramName, $this->processedValues)) {
                if (!\array_key_exists($paramName, $this->values)) {
                    throw new SyntaxError(
                        sprintf('Variable "%s" is not valid.', $paramName),
                        0,
                        $value->getExpression(),
                        $paramName,
                        array_keys($this->values)
                    );
                }
                $this->processRootValue($paramName, $this->values[$paramName], $context, $data, $evaluate, $encoding);
            }
            $params[$paramName] = $this->processedValues[$paramName];
        }

        $closure = $value->getClosure();

        return $closure($context, $data, ...array_values($params));
    }
                                            
ClosureWithExtraParams's Other Methods
ClosureWithExtraParams's Other Methods