mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-02 21:19:58 +09:00
updated dependencies + working api connection
This commit is contained in:
@@ -43,17 +43,38 @@ class AttributeMatchingExtension extends AbstractExtension
|
||||
);
|
||||
}
|
||||
|
||||
public function translateExists(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
|
||||
/**
|
||||
* @param XPathExpr $xpath
|
||||
* @param string $attribute
|
||||
* @param string $value
|
||||
*
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateExists(XPathExpr $xpath, $attribute, $value)
|
||||
{
|
||||
return $xpath->addCondition($attribute);
|
||||
}
|
||||
|
||||
public function translateEquals(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
|
||||
/**
|
||||
* @param XPathExpr $xpath
|
||||
* @param string $attribute
|
||||
* @param string $value
|
||||
*
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateEquals(XPathExpr $xpath, $attribute, $value)
|
||||
{
|
||||
return $xpath->addCondition(sprintf('%s = %s', $attribute, Translator::getXpathLiteral($value)));
|
||||
}
|
||||
|
||||
public function translateIncludes(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
|
||||
/**
|
||||
* @param XPathExpr $xpath
|
||||
* @param string $attribute
|
||||
* @param string $value
|
||||
*
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateIncludes(XPathExpr $xpath, $attribute, $value)
|
||||
{
|
||||
return $xpath->addCondition($value ? sprintf(
|
||||
'%1$s and contains(concat(\' \', normalize-space(%1$s), \' \'), %2$s)',
|
||||
@@ -62,7 +83,14 @@ class AttributeMatchingExtension extends AbstractExtension
|
||||
) : '0');
|
||||
}
|
||||
|
||||
public function translateDashMatch(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
|
||||
/**
|
||||
* @param XPathExpr $xpath
|
||||
* @param string $attribute
|
||||
* @param string $value
|
||||
*
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateDashMatch(XPathExpr $xpath, $attribute, $value)
|
||||
{
|
||||
return $xpath->addCondition(sprintf(
|
||||
'%1$s and (%1$s = %2$s or starts-with(%1$s, %3$s))',
|
||||
@@ -72,7 +100,14 @@ class AttributeMatchingExtension extends AbstractExtension
|
||||
));
|
||||
}
|
||||
|
||||
public function translatePrefixMatch(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
|
||||
/**
|
||||
* @param XPathExpr $xpath
|
||||
* @param string $attribute
|
||||
* @param string $value
|
||||
*
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translatePrefixMatch(XPathExpr $xpath, $attribute, $value)
|
||||
{
|
||||
return $xpath->addCondition($value ? sprintf(
|
||||
'%1$s and starts-with(%1$s, %2$s)',
|
||||
@@ -81,7 +116,14 @@ class AttributeMatchingExtension extends AbstractExtension
|
||||
) : '0');
|
||||
}
|
||||
|
||||
public function translateSuffixMatch(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
|
||||
/**
|
||||
* @param XPathExpr $xpath
|
||||
* @param string $attribute
|
||||
* @param string $value
|
||||
*
|
||||
* @return XPathExpr
|
||||
*/
|
||||
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',
|
||||
@@ -91,7 +133,14 @@ class AttributeMatchingExtension extends AbstractExtension
|
||||
) : '0');
|
||||
}
|
||||
|
||||
public function translateSubstringMatch(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
|
||||
/**
|
||||
* @param XPathExpr $xpath
|
||||
* @param string $attribute
|
||||
* @param string $value
|
||||
*
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateSubstringMatch(XPathExpr $xpath, $attribute, $value)
|
||||
{
|
||||
return $xpath->addCondition($value ? sprintf(
|
||||
'%1$s and contains(%1$s, %2$s)',
|
||||
@@ -100,7 +149,14 @@ class AttributeMatchingExtension extends AbstractExtension
|
||||
) : '0');
|
||||
}
|
||||
|
||||
public function translateDifferent(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
|
||||
/**
|
||||
* @param XPathExpr $xpath
|
||||
* @param string $attribute
|
||||
* @param string $value
|
||||
*
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateDifferent(XPathExpr $xpath, $attribute, $value)
|
||||
{
|
||||
return $xpath->addCondition(sprintf(
|
||||
$value ? 'not(%1$s) or %1$s != %2$s' : '%s != %s',
|
||||
|
||||
Reference in New Issue
Block a user