public function FunctionExtension::translateLang in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/css-selector/XPath/Extension/FunctionExtension.php \Symfony\Component\CssSelector\XPath\Extension\FunctionExtension::translateLang()
Parameters
XPathExpr $xpath:
FunctionNode $function:
Return value
Throws
File
- vendor/
symfony/ css-selector/ XPath/ Extension/ FunctionExtension.php, line 184
Class
- FunctionExtension
- XPath expression translator function extension.
Namespace
Symfony\Component\CssSelector\XPath\ExtensionCode
public function translateLang(XPathExpr $xpath, FunctionNode $function) {
$arguments = $function
->getArguments();
foreach ($arguments as $token) {
if (!($token
->isString() || $token
->isIdentifier())) {
throw new ExpressionErrorException('Expected a single string or identifier for :lang(), got ' . implode(', ', $arguments));
}
}
return $xpath
->addCondition(sprintf('lang(%s)', Translator::getXpathLiteral($arguments[0]
->getValue())));
}