AbstractNode.php
2 years ago
AttributeNode.php
2 years ago
ClassNode.php
2 years ago
CombinedSelectorNode.php
2 years ago
ElementNode.php
2 years ago
FunctionNode.php
2 years ago
HashNode.php
2 years ago
NegationNode.php
2 years ago
NodeInterface.php
2 years ago
PseudoNode.php
2 years ago
SelectorNode.php
2 years ago
Specificity.php
2 years ago
index.php
2 years ago
CombinedSelectorNode.php
37 lines
| 1 | <?php |
| 2 | namespace MailPoetVendor\Symfony\Component\CssSelector\Node; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | class CombinedSelectorNode extends AbstractNode |
| 5 | { |
| 6 | private $selector; |
| 7 | private $combinator; |
| 8 | private $subSelector; |
| 9 | public function __construct(NodeInterface $selector, string $combinator, NodeInterface $subSelector) |
| 10 | { |
| 11 | $this->selector = $selector; |
| 12 | $this->combinator = $combinator; |
| 13 | $this->subSelector = $subSelector; |
| 14 | } |
| 15 | public function getSelector() : NodeInterface |
| 16 | { |
| 17 | return $this->selector; |
| 18 | } |
| 19 | public function getCombinator() : string |
| 20 | { |
| 21 | return $this->combinator; |
| 22 | } |
| 23 | public function getSubSelector() : NodeInterface |
| 24 | { |
| 25 | return $this->subSelector; |
| 26 | } |
| 27 | public function getSpecificity() : Specificity |
| 28 | { |
| 29 | return $this->selector->getSpecificity()->plus($this->subSelector->getSpecificity()); |
| 30 | } |
| 31 | public function __toString() : string |
| 32 | { |
| 33 | $combinator = ' ' === $this->combinator ? '<followed>' : $this->combinator; |
| 34 | return \sprintf('%s[%s %s %s]', $this->getNodeName(), $this->selector, $combinator, $this->subSelector); |
| 35 | } |
| 36 | } |
| 37 |