public function NodeExtension::translateElement in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/css-selector/XPath/Extension/NodeExtension.php \Symfony\Component\CssSelector\XPath\Extension\NodeExtension::translateElement()
Parameters
Node\ElementNode $node:
Return value
File
- vendor/
symfony/ css-selector/ XPath/ Extension/ NodeExtension.php, line 223
Class
- NodeExtension
- XPath expression translator node extension.
Namespace
Symfony\Component\CssSelector\XPath\ExtensionCode
public function translateElement(Node\ElementNode $node) {
$element = $node
->getElement();
if ($this
->hasFlag(self::ELEMENT_NAME_IN_LOWER_CASE)) {
$element = strtolower($element);
}
if ($element) {
$safe = $this
->isSafeName($element);
}
else {
$element = '*';
$safe = true;
}
if ($node
->getNamespace()) {
$element = sprintf('%s:%s', $node
->getNamespace(), $element);
$safe = $safe && $this
->isSafeName($node
->getNamespace());
}
$xpath = new XPathExpr('', $element);
if (!$safe) {
$xpath
->addNameTest();
}
return $xpath;
}