You are here

public function AttributeMatchingExtension::translateSuffixMatch in Zircon Profile 8.0

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

Parameters

XPathExpr $xpath:

string $attribute:

string $value:

Return value

XPathExpr

File

vendor/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php, line 124

Class

AttributeMatchingExtension
XPath expression translator attribute extension.

Namespace

Symfony\Component\CssSelector\XPath\Extension

Code

public function translateSuffixMatch(XPathExpr $xpath, $attribute, $value) {
  return $xpath
    ->addCondition($value ? sprintf('%1$s and substring(%1$s, string-length(%1$s)-%2$s) = %3$s', $attribute, strlen($value) - 1, Translator::getXpathLiteral($value)) : '0');
}