You are here

public function Translator::addFunction in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/css-selector/XPath/Translator.php \Symfony\Component\CssSelector\XPath\Translator::addFunction()

Parameters

XPathExpr $xpath:

FunctionNode $function:

Return value

XPathExpr

Throws

ExpressionErrorException

File

vendor/symfony/css-selector/XPath/Translator.php, line 237

Class

Translator
XPath expression translator interface.

Namespace

Symfony\Component\CssSelector\XPath

Code

public function addFunction(XPathExpr $xpath, FunctionNode $function) {
  if (!isset($this->functionTranslators[$function
    ->getName()])) {
    throw new ExpressionErrorException(sprintf('Function "%s" not supported.', $function
      ->getName()));
  }
  return call_user_func($this->functionTranslators[$function
    ->getName()], $xpath, $function);
}