class Escaper in Zircon Profile 8.0
Same name in this branch
- 8.0 vendor/symfony/yaml/Escaper.php \Symfony\Component\Yaml\Escaper
- 8.0 vendor/zendframework/zend-escaper/src/Escaper.php \Zend\Escaper\Escaper
- 8.0 vendor/behat/mink/src/Selector/Xpath/Escaper.php \Behat\Mink\Selector\Xpath\Escaper
Same name and namespace in other branches
- 8 vendor/behat/mink/src/Selector/Xpath/Escaper.php \Behat\Mink\Selector\Xpath\Escaper
XPath escaper.
@author Konstantin Kudryashov <ever.zet@gmail.com>
Hierarchy
- class \Behat\Mink\Selector\Xpath\Escaper
Expanded class hierarchy of Escaper
4 files declare their use of Escaper
- EscaperTest.php in vendor/
behat/ mink/ tests/ Selector/ Xpath/ EscaperTest.php - NamedSelector.php in vendor/
behat/ mink/ src/ Selector/ NamedSelector.php - NamedSelectorTest.php in vendor/
behat/ mink/ tests/ Selector/ NamedSelectorTest.php - SelectorsHandler.php in vendor/
behat/ mink/ src/ Selector/ SelectorsHandler.php
File
- vendor/
behat/ mink/ src/ Selector/ Xpath/ Escaper.php, line 18
Namespace
Behat\Mink\Selector\XpathView source
class Escaper {
/**
* Escapes the string as a XPath literal.
*
* @param string $s
*
* @return string
*/
public function escapeLiteral($s) {
if (false === strpos($s, "'")) {
return sprintf("'%s'", $s);
}
if (false === strpos($s, '"')) {
return sprintf('"%s"', $s);
}
$string = $s;
$parts = array();
while (true) {
if (false !== ($pos = strpos($string, "'"))) {
$parts[] = sprintf("'%s'", substr($string, 0, $pos));
$parts[] = "\"'\"";
$string = substr($string, $pos + 1);
}
else {
$parts[] = "'{$string}'";
break;
}
}
return sprintf('concat(%s)', implode($parts, ','));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Escaper:: |
public | function | Escapes the string as a XPath literal. |