mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-03 05:29:53 +09:00
updated dependencies + working api connection
This commit is contained in:
67
vendor/symfony/css-selector/XPath/Translator.php
vendored
67
vendor/symfony/css-selector/XPath/Translator.php
vendored
@@ -61,7 +61,12 @@ class Translator implements TranslatorInterface
|
||||
;
|
||||
}
|
||||
|
||||
public static function getXpathLiteral(string $element): string
|
||||
/**
|
||||
* @param string $element
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getXpathLiteral($element)
|
||||
{
|
||||
if (false === strpos($element, "'")) {
|
||||
return "'".$element."'";
|
||||
@@ -90,7 +95,7 @@ class Translator implements TranslatorInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function cssToXPath(string $cssExpr, string $prefix = 'descendant-or-self::'): string
|
||||
public function cssToXPath($cssExpr, $prefix = 'descendant-or-self::')
|
||||
{
|
||||
$selectors = $this->parseSelectors($cssExpr);
|
||||
|
||||
@@ -109,12 +114,17 @@ class Translator implements TranslatorInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function selectorToXPath(SelectorNode $selector, string $prefix = 'descendant-or-self::'): string
|
||||
public function selectorToXPath(SelectorNode $selector, $prefix = 'descendant-or-self::')
|
||||
{
|
||||
return ($prefix ?: '').$this->nodeToXPath($selector);
|
||||
}
|
||||
|
||||
public function registerExtension(Extension\ExtensionInterface $extension): Translator
|
||||
/**
|
||||
* Registers an extension.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function registerExtension(Extension\ExtensionInterface $extension)
|
||||
{
|
||||
$this->extensions[$extension->getName()] = $extension;
|
||||
|
||||
@@ -128,9 +138,13 @@ class Translator implements TranslatorInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*
|
||||
* @return Extension\ExtensionInterface
|
||||
*
|
||||
* @throws ExpressionErrorException
|
||||
*/
|
||||
public function getExtension(string $name): Extension\ExtensionInterface
|
||||
public function getExtension($name)
|
||||
{
|
||||
if (!isset($this->extensions[$name])) {
|
||||
throw new ExpressionErrorException(sprintf('Extension "%s" not registered.', $name));
|
||||
@@ -139,7 +153,12 @@ class Translator implements TranslatorInterface
|
||||
return $this->extensions[$name];
|
||||
}
|
||||
|
||||
public function registerParserShortcut(ParserInterface $shortcut): Translator
|
||||
/**
|
||||
* Registers a shortcut parser.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function registerParserShortcut(ParserInterface $shortcut)
|
||||
{
|
||||
$this->shortcutParsers[] = $shortcut;
|
||||
|
||||
@@ -147,9 +166,11 @@ class Translator implements TranslatorInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*
|
||||
* @throws ExpressionErrorException
|
||||
*/
|
||||
public function nodeToXPath(NodeInterface $node): XPathExpr
|
||||
public function nodeToXPath(NodeInterface $node)
|
||||
{
|
||||
if (!isset($this->nodeTranslators[$node->getNodeName()])) {
|
||||
throw new ExpressionErrorException(sprintf('Node "%s" not supported.', $node->getNodeName()));
|
||||
@@ -159,9 +180,15 @@ class Translator implements TranslatorInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $combiner
|
||||
* @param NodeInterface $xpath
|
||||
* @param NodeInterface $combinedXpath
|
||||
*
|
||||
* @return XPathExpr
|
||||
*
|
||||
* @throws ExpressionErrorException
|
||||
*/
|
||||
public function addCombination(string $combiner, NodeInterface $xpath, NodeInterface $combinedXpath): XPathExpr
|
||||
public function addCombination($combiner, NodeInterface $xpath, NodeInterface $combinedXpath)
|
||||
{
|
||||
if (!isset($this->combinationTranslators[$combiner])) {
|
||||
throw new ExpressionErrorException(sprintf('Combiner "%s" not supported.', $combiner));
|
||||
@@ -171,9 +198,11 @@ class Translator implements TranslatorInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*
|
||||
* @throws ExpressionErrorException
|
||||
*/
|
||||
public function addFunction(XPathExpr $xpath, FunctionNode $function): XPathExpr
|
||||
public function addFunction(XPathExpr $xpath, FunctionNode $function)
|
||||
{
|
||||
if (!isset($this->functionTranslators[$function->getName()])) {
|
||||
throw new ExpressionErrorException(sprintf('Function "%s" not supported.', $function->getName()));
|
||||
@@ -183,9 +212,14 @@ class Translator implements TranslatorInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param XPathExpr $xpath
|
||||
* @param string $pseudoClass
|
||||
*
|
||||
* @return XPathExpr
|
||||
*
|
||||
* @throws ExpressionErrorException
|
||||
*/
|
||||
public function addPseudoClass(XPathExpr $xpath, string $pseudoClass): XPathExpr
|
||||
public function addPseudoClass(XPathExpr $xpath, $pseudoClass)
|
||||
{
|
||||
if (!isset($this->pseudoClassTranslators[$pseudoClass])) {
|
||||
throw new ExpressionErrorException(sprintf('Pseudo-class "%s" not supported.', $pseudoClass));
|
||||
@@ -195,9 +229,16 @@ class Translator implements TranslatorInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param XPathExpr $xpath
|
||||
* @param string $operator
|
||||
* @param string $attribute
|
||||
* @param string $value
|
||||
*
|
||||
* @return XPathExpr
|
||||
*
|
||||
* @throws ExpressionErrorException
|
||||
*/
|
||||
public function addAttributeMatching(XPathExpr $xpath, string $operator, string $attribute, $value): XPathExpr
|
||||
public function addAttributeMatching(XPathExpr $xpath, $operator, $attribute, $value)
|
||||
{
|
||||
if (!isset($this->attributeMatchingTranslators[$operator])) {
|
||||
throw new ExpressionErrorException(sprintf('Attribute matcher operator "%s" not supported.', $operator));
|
||||
@@ -207,9 +248,11 @@ class Translator implements TranslatorInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $css
|
||||
*
|
||||
* @return SelectorNode[]
|
||||
*/
|
||||
private function parseSelectors(string $css)
|
||||
private function parseSelectors($css)
|
||||
{
|
||||
foreach ($this->shortcutParsers as $shortcut) {
|
||||
$tokens = $shortcut->parse($css);
|
||||
|
||||
Reference in New Issue
Block a user