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