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
NegationNode.php
30 lines
| 1 | <?php |
| 2 | namespace MailPoetVendor\Symfony\Component\CssSelector\Node; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | class NegationNode extends AbstractNode |
| 5 | { |
| 6 | private $selector; |
| 7 | private $subSelector; |
| 8 | public function __construct(NodeInterface $selector, NodeInterface $subSelector) |
| 9 | { |
| 10 | $this->selector = $selector; |
| 11 | $this->subSelector = $subSelector; |
| 12 | } |
| 13 | public function getSelector() : NodeInterface |
| 14 | { |
| 15 | return $this->selector; |
| 16 | } |
| 17 | public function getSubSelector() : NodeInterface |
| 18 | { |
| 19 | return $this->subSelector; |
| 20 | } |
| 21 | public function getSpecificity() : Specificity |
| 22 | { |
| 23 | return $this->selector->getSpecificity()->plus($this->subSelector->getSpecificity()); |
| 24 | } |
| 25 | public function __toString() : string |
| 26 | { |
| 27 | return \sprintf('%s[%s:not(%s)]', $this->getNodeName(), $this->selector, $this->subSelector); |
| 28 | } |
| 29 | } |
| 30 |