package and depencies
This commit is contained in:
@@ -26,11 +26,11 @@ use Symfony\Component\CssSelector\XPath\Translator;
|
||||
*/
|
||||
class CssSelectorConverter
|
||||
{
|
||||
private $translator;
|
||||
private $cache;
|
||||
private Translator $translator;
|
||||
private array $cache;
|
||||
|
||||
private static $xmlCache = [];
|
||||
private static $htmlCache = [];
|
||||
private static array $xmlCache = [];
|
||||
private static array $htmlCache = [];
|
||||
|
||||
/**
|
||||
* @param bool $html Whether HTML support should be enabled. Disable it for XML documents
|
||||
@@ -59,11 +59,9 @@ class CssSelectorConverter
|
||||
*
|
||||
* Optionally, a prefix can be added to the resulting XPath
|
||||
* expression with the $prefix parameter.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toXPath(string $cssExpr, string $prefix = 'descendant-or-self::')
|
||||
public function toXPath(string $cssExpr, string $prefix = 'descendant-or-self::'): string
|
||||
{
|
||||
return $this->cache[$prefix][$cssExpr] ?? $this->cache[$prefix][$cssExpr] = $this->translator->cssToXPath($cssExpr, $prefix);
|
||||
return $this->cache[$prefix][$cssExpr] ??= $this->translator->cssToXPath($cssExpr, $prefix);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user