Commaaa2
This commit is contained in:
@@ -23,19 +23,13 @@ namespace Symfony\Component\CssSelector\Node;
|
||||
*/
|
||||
class AttributeNode extends AbstractNode
|
||||
{
|
||||
private $selector;
|
||||
private ?string $namespace;
|
||||
private string $attribute;
|
||||
private string $operator;
|
||||
private ?string $value;
|
||||
|
||||
public function __construct(NodeInterface $selector, ?string $namespace, string $attribute, string $operator, ?string $value)
|
||||
{
|
||||
$this->selector = $selector;
|
||||
$this->namespace = $namespace;
|
||||
$this->attribute = $attribute;
|
||||
$this->operator = $operator;
|
||||
$this->value = $value;
|
||||
public function __construct(
|
||||
private NodeInterface $selector,
|
||||
private ?string $namespace,
|
||||
private string $attribute,
|
||||
private string $operator,
|
||||
private ?string $value,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getSelector(): NodeInterface
|
||||
@@ -63,9 +57,6 @@ class AttributeNode extends AbstractNode
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSpecificity(): Specificity
|
||||
{
|
||||
return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0));
|
||||
|
||||
14
vendor/symfony/css-selector/Node/ClassNode.php
vendored
14
vendor/symfony/css-selector/Node/ClassNode.php
vendored
@@ -23,13 +23,10 @@ namespace Symfony\Component\CssSelector\Node;
|
||||
*/
|
||||
class ClassNode extends AbstractNode
|
||||
{
|
||||
private $selector;
|
||||
private string $name;
|
||||
|
||||
public function __construct(NodeInterface $selector, string $name)
|
||||
{
|
||||
$this->selector = $selector;
|
||||
$this->name = $name;
|
||||
public function __construct(
|
||||
private NodeInterface $selector,
|
||||
private string $name,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getSelector(): NodeInterface
|
||||
@@ -42,9 +39,6 @@ class ClassNode extends AbstractNode
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSpecificity(): Specificity
|
||||
{
|
||||
return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0));
|
||||
|
||||
@@ -23,15 +23,11 @@ namespace Symfony\Component\CssSelector\Node;
|
||||
*/
|
||||
class CombinedSelectorNode extends AbstractNode
|
||||
{
|
||||
private $selector;
|
||||
private string $combinator;
|
||||
private $subSelector;
|
||||
|
||||
public function __construct(NodeInterface $selector, string $combinator, NodeInterface $subSelector)
|
||||
{
|
||||
$this->selector = $selector;
|
||||
$this->combinator = $combinator;
|
||||
$this->subSelector = $subSelector;
|
||||
public function __construct(
|
||||
private NodeInterface $selector,
|
||||
private string $combinator,
|
||||
private NodeInterface $subSelector,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getSelector(): NodeInterface
|
||||
@@ -49,9 +45,6 @@ class CombinedSelectorNode extends AbstractNode
|
||||
return $this->subSelector;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSpecificity(): Specificity
|
||||
{
|
||||
return $this->selector->getSpecificity()->plus($this->subSelector->getSpecificity());
|
||||
|
||||
14
vendor/symfony/css-selector/Node/ElementNode.php
vendored
14
vendor/symfony/css-selector/Node/ElementNode.php
vendored
@@ -23,13 +23,10 @@ namespace Symfony\Component\CssSelector\Node;
|
||||
*/
|
||||
class ElementNode extends AbstractNode
|
||||
{
|
||||
private ?string $namespace;
|
||||
private ?string $element;
|
||||
|
||||
public function __construct(string $namespace = null, string $element = null)
|
||||
{
|
||||
$this->namespace = $namespace;
|
||||
$this->element = $element;
|
||||
public function __construct(
|
||||
private ?string $namespace = null,
|
||||
private ?string $element = null,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getNamespace(): ?string
|
||||
@@ -42,9 +39,6 @@ class ElementNode extends AbstractNode
|
||||
return $this->element;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSpecificity(): Specificity
|
||||
{
|
||||
return new Specificity(0, 0, $this->element ? 1 : 0);
|
||||
|
||||
@@ -25,18 +25,17 @@ use Symfony\Component\CssSelector\Parser\Token;
|
||||
*/
|
||||
class FunctionNode extends AbstractNode
|
||||
{
|
||||
private $selector;
|
||||
private string $name;
|
||||
private array $arguments;
|
||||
|
||||
/**
|
||||
* @param Token[] $arguments
|
||||
*/
|
||||
public function __construct(NodeInterface $selector, string $name, array $arguments = [])
|
||||
{
|
||||
$this->selector = $selector;
|
||||
public function __construct(
|
||||
private NodeInterface $selector,
|
||||
string $name,
|
||||
private array $arguments = [],
|
||||
) {
|
||||
$this->name = strtolower($name);
|
||||
$this->arguments = $arguments;
|
||||
}
|
||||
|
||||
public function getSelector(): NodeInterface
|
||||
@@ -57,9 +56,6 @@ class FunctionNode extends AbstractNode
|
||||
return $this->arguments;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSpecificity(): Specificity
|
||||
{
|
||||
return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0));
|
||||
@@ -67,9 +63,7 @@ class FunctionNode extends AbstractNode
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
$arguments = implode(', ', array_map(function (Token $token) {
|
||||
return "'".$token->getValue()."'";
|
||||
}, $this->arguments));
|
||||
$arguments = implode(', ', array_map(fn (Token $token) => "'".$token->getValue()."'", $this->arguments));
|
||||
|
||||
return sprintf('%s[%s:%s(%s)]', $this->getNodeName(), $this->selector, $this->name, $arguments ? '['.$arguments.']' : '');
|
||||
}
|
||||
|
||||
14
vendor/symfony/css-selector/Node/HashNode.php
vendored
14
vendor/symfony/css-selector/Node/HashNode.php
vendored
@@ -23,13 +23,10 @@ namespace Symfony\Component\CssSelector\Node;
|
||||
*/
|
||||
class HashNode extends AbstractNode
|
||||
{
|
||||
private $selector;
|
||||
private string $id;
|
||||
|
||||
public function __construct(NodeInterface $selector, string $id)
|
||||
{
|
||||
$this->selector = $selector;
|
||||
$this->id = $id;
|
||||
public function __construct(
|
||||
private NodeInterface $selector,
|
||||
private string $id,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getSelector(): NodeInterface
|
||||
@@ -42,9 +39,6 @@ class HashNode extends AbstractNode
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSpecificity(): Specificity
|
||||
{
|
||||
return $this->selector->getSpecificity()->plus(new Specificity(1, 0, 0));
|
||||
|
||||
@@ -23,13 +23,10 @@ namespace Symfony\Component\CssSelector\Node;
|
||||
*/
|
||||
class NegationNode extends AbstractNode
|
||||
{
|
||||
private $selector;
|
||||
private $subSelector;
|
||||
|
||||
public function __construct(NodeInterface $selector, NodeInterface $subSelector)
|
||||
{
|
||||
$this->selector = $selector;
|
||||
$this->subSelector = $subSelector;
|
||||
public function __construct(
|
||||
private NodeInterface $selector,
|
||||
private NodeInterface $subSelector,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getSelector(): NodeInterface
|
||||
@@ -42,9 +39,6 @@ class NegationNode extends AbstractNode
|
||||
return $this->subSelector;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSpecificity(): Specificity
|
||||
{
|
||||
return $this->selector->getSpecificity()->plus($this->subSelector->getSpecificity());
|
||||
|
||||
@@ -21,11 +21,9 @@ namespace Symfony\Component\CssSelector\Node;
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
interface NodeInterface
|
||||
interface NodeInterface extends \Stringable
|
||||
{
|
||||
public function getNodeName(): string;
|
||||
|
||||
public function getSpecificity(): Specificity;
|
||||
|
||||
public function __toString(): string;
|
||||
}
|
||||
|
||||
11
vendor/symfony/css-selector/Node/PseudoNode.php
vendored
11
vendor/symfony/css-selector/Node/PseudoNode.php
vendored
@@ -23,12 +23,12 @@ namespace Symfony\Component\CssSelector\Node;
|
||||
*/
|
||||
class PseudoNode extends AbstractNode
|
||||
{
|
||||
private $selector;
|
||||
private string $identifier;
|
||||
|
||||
public function __construct(NodeInterface $selector, string $identifier)
|
||||
{
|
||||
$this->selector = $selector;
|
||||
public function __construct(
|
||||
private NodeInterface $selector,
|
||||
string $identifier,
|
||||
) {
|
||||
$this->identifier = strtolower($identifier);
|
||||
}
|
||||
|
||||
@@ -42,9 +42,6 @@ class PseudoNode extends AbstractNode
|
||||
return $this->identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSpecificity(): Specificity
|
||||
{
|
||||
return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0));
|
||||
|
||||
@@ -23,12 +23,12 @@ namespace Symfony\Component\CssSelector\Node;
|
||||
*/
|
||||
class SelectorNode extends AbstractNode
|
||||
{
|
||||
private $tree;
|
||||
private ?string $pseudoElement;
|
||||
|
||||
public function __construct(NodeInterface $tree, string $pseudoElement = null)
|
||||
{
|
||||
$this->tree = $tree;
|
||||
public function __construct(
|
||||
private NodeInterface $tree,
|
||||
?string $pseudoElement = null,
|
||||
) {
|
||||
$this->pseudoElement = $pseudoElement ? strtolower($pseudoElement) : null;
|
||||
}
|
||||
|
||||
@@ -42,9 +42,6 @@ class SelectorNode extends AbstractNode
|
||||
return $this->pseudoElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSpecificity(): Specificity
|
||||
{
|
||||
return $this->tree->getSpecificity()->plus(new Specificity(0, 0, $this->pseudoElement ? 1 : 0));
|
||||
|
||||
14
vendor/symfony/css-selector/Node/Specificity.php
vendored
14
vendor/symfony/css-selector/Node/Specificity.php
vendored
@@ -29,15 +29,11 @@ class Specificity
|
||||
public const B_FACTOR = 10;
|
||||
public const C_FACTOR = 1;
|
||||
|
||||
private int $a;
|
||||
private int $b;
|
||||
private int $c;
|
||||
|
||||
public function __construct(int $a, int $b, int $c)
|
||||
{
|
||||
$this->a = $a;
|
||||
$this->b = $b;
|
||||
$this->c = $c;
|
||||
public function __construct(
|
||||
private int $a,
|
||||
private int $b,
|
||||
private int $c,
|
||||
) {
|
||||
}
|
||||
|
||||
public function plus(self $specificity): self
|
||||
|
||||
Reference in New Issue
Block a user