updated packages

This commit is contained in:
2019-05-18 09:06:43 +00:00
parent 901d16349e
commit e9487fa58a
2025 changed files with 30366 additions and 49653 deletions

View File

@@ -28,7 +28,7 @@ abstract class AbstractExtension implements ExtensionInterface
*/
public function getNodeTranslators()
{
return array();
return [];
}
/**
@@ -36,7 +36,7 @@ abstract class AbstractExtension implements ExtensionInterface
*/
public function getCombinationTranslators()
{
return array();
return [];
}
/**
@@ -44,7 +44,7 @@ abstract class AbstractExtension implements ExtensionInterface
*/
public function getFunctionTranslators()
{
return array();
return [];
}
/**
@@ -52,7 +52,7 @@ abstract class AbstractExtension implements ExtensionInterface
*/
public function getPseudoClassTranslators()
{
return array();
return [];
}
/**
@@ -60,6 +60,6 @@ abstract class AbstractExtension implements ExtensionInterface
*/
public function getAttributeMatchingTranslators()
{
return array();
return [];
}
}

View File

@@ -31,16 +31,16 @@ class AttributeMatchingExtension extends AbstractExtension
*/
public function getAttributeMatchingTranslators()
{
return array(
'exists' => array($this, 'translateExists'),
'=' => array($this, 'translateEquals'),
'~=' => array($this, 'translateIncludes'),
'|=' => array($this, 'translateDashMatch'),
'^=' => array($this, 'translatePrefixMatch'),
'$=' => array($this, 'translateSuffixMatch'),
'*=' => array($this, 'translateSubstringMatch'),
'!=' => array($this, 'translateDifferent'),
);
return [
'exists' => [$this, 'translateExists'],
'=' => [$this, 'translateEquals'],
'~=' => [$this, 'translateIncludes'],
'|=' => [$this, 'translateDashMatch'],
'^=' => [$this, 'translatePrefixMatch'],
'$=' => [$this, 'translateSuffixMatch'],
'*=' => [$this, 'translateSubstringMatch'],
'!=' => [$this, 'translateDifferent'],
];
}
public function translateExists(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr

View File

@@ -30,12 +30,12 @@ class CombinationExtension extends AbstractExtension
*/
public function getCombinationTranslators(): array
{
return array(
' ' => array($this, 'translateDescendant'),
'>' => array($this, 'translateChild'),
'+' => array($this, 'translateDirectAdjacent'),
'~' => array($this, 'translateIndirectAdjacent'),
);
return [
' ' => [$this, 'translateDescendant'],
'>' => [$this, 'translateChild'],
'+' => [$this, 'translateDirectAdjacent'],
'~' => [$this, 'translateIndirectAdjacent'],
];
}
/**

View File

@@ -35,14 +35,14 @@ class FunctionExtension extends AbstractExtension
*/
public function getFunctionTranslators()
{
return array(
'nth-child' => array($this, 'translateNthChild'),
'nth-last-child' => array($this, 'translateNthLastChild'),
'nth-of-type' => array($this, 'translateNthOfType'),
'nth-last-of-type' => array($this, 'translateNthLastOfType'),
'contains' => array($this, 'translateContains'),
'lang' => array($this, 'translateLang'),
);
return [
'nth-child' => [$this, 'translateNthChild'],
'nth-last-child' => [$this, 'translateNthLastChild'],
'nth-of-type' => [$this, 'translateNthOfType'],
'nth-last-of-type' => [$this, 'translateNthLastOfType'],
'contains' => [$this, 'translateContains'],
'lang' => [$this, 'translateLang'],
];
}
/**
@@ -86,7 +86,7 @@ class FunctionExtension extends AbstractExtension
$expr .= ' - '.$b;
}
$conditions = array(sprintf('%s %s 0', $expr, $sign));
$conditions = [sprintf('%s %s 0', $expr, $sign)];
if (1 !== $a && -1 !== $a) {
$conditions[] = sprintf('(%s) mod %d = 0', $expr, $a);

View File

@@ -41,16 +41,16 @@ class HtmlExtension extends AbstractExtension
*/
public function getPseudoClassTranslators()
{
return array(
'checked' => array($this, 'translateChecked'),
'link' => array($this, 'translateLink'),
'disabled' => array($this, 'translateDisabled'),
'enabled' => array($this, 'translateEnabled'),
'selected' => array($this, 'translateSelected'),
'invalid' => array($this, 'translateInvalid'),
'hover' => array($this, 'translateHover'),
'visited' => array($this, 'translateVisited'),
);
return [
'checked' => [$this, 'translateChecked'],
'link' => [$this, 'translateLink'],
'disabled' => [$this, 'translateDisabled'],
'enabled' => [$this, 'translateEnabled'],
'selected' => [$this, 'translateSelected'],
'invalid' => [$this, 'translateInvalid'],
'hover' => [$this, 'translateHover'],
'visited' => [$this, 'translateVisited'],
];
}
/**
@@ -58,9 +58,9 @@ class HtmlExtension extends AbstractExtension
*/
public function getFunctionTranslators()
{
return array(
'lang' => array($this, 'translateLang'),
);
return [
'lang' => [$this, 'translateLang'],
];
}
/**

View File

@@ -64,17 +64,17 @@ class NodeExtension extends AbstractExtension
*/
public function getNodeTranslators()
{
return array(
'Selector' => array($this, 'translateSelector'),
'CombinedSelector' => array($this, 'translateCombinedSelector'),
'Negation' => array($this, 'translateNegation'),
'Function' => array($this, 'translateFunction'),
'Pseudo' => array($this, 'translatePseudo'),
'Attribute' => array($this, 'translateAttribute'),
'Class' => array($this, 'translateClass'),
'Hash' => array($this, 'translateHash'),
'Element' => array($this, 'translateElement'),
);
return [
'Selector' => [$this, 'translateSelector'],
'CombinedSelector' => [$this, 'translateCombinedSelector'],
'Negation' => [$this, 'translateNegation'],
'Function' => [$this, 'translateFunction'],
'Pseudo' => [$this, 'translatePseudo'],
'Attribute' => [$this, 'translateAttribute'],
'Class' => [$this, 'translateClass'],
'Hash' => [$this, 'translateHash'],
'Element' => [$this, 'translateElement'],
];
}
public function translateSelector(Node\SelectorNode $node, Translator $translator): XPathExpr

View File

@@ -31,16 +31,16 @@ class PseudoClassExtension extends AbstractExtension
*/
public function getPseudoClassTranslators()
{
return array(
'root' => array($this, 'translateRoot'),
'first-child' => array($this, 'translateFirstChild'),
'last-child' => array($this, 'translateLastChild'),
'first-of-type' => array($this, 'translateFirstOfType'),
'last-of-type' => array($this, 'translateLastOfType'),
'only-child' => array($this, 'translateOnlyChild'),
'only-of-type' => array($this, 'translateOnlyOfType'),
'empty' => array($this, 'translateEmpty'),
);
return [
'root' => [$this, 'translateRoot'],
'first-child' => [$this, 'translateFirstChild'],
'last-child' => [$this, 'translateLastChild'],
'first-of-type' => [$this, 'translateFirstOfType'],
'last-of-type' => [$this, 'translateLastOfType'],
'only-child' => [$this, 'translateOnlyChild'],
'only-of-type' => [$this, 'translateOnlyOfType'],
'empty' => [$this, 'translateEmpty'],
];
}
/**

View File

@@ -35,18 +35,18 @@ class Translator implements TranslatorInterface
/**
* @var ParserInterface[]
*/
private $shortcutParsers = array();
private $shortcutParsers = [];
/**
* @var Extension\ExtensionInterface[]
*/
private $extensions = array();
private $extensions = [];
private $nodeTranslators = array();
private $combinationTranslators = array();
private $functionTranslators = array();
private $pseudoClassTranslators = array();
private $attributeMatchingTranslators = array();
private $nodeTranslators = [];
private $combinationTranslators = [];
private $functionTranslators = [];
private $pseudoClassTranslators = [];
private $attributeMatchingTranslators = [];
public function __construct(ParserInterface $parser = null)
{
@@ -72,7 +72,7 @@ class Translator implements TranslatorInterface
}
$string = $element;
$parts = array();
$parts = [];
while (true) {
if (false !== $pos = strpos($string, "'")) {
$parts[] = sprintf("'%s'", substr($string, 0, $pos));