You are here

class HashNode in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/css-selector/Node/HashNode.php \Symfony\Component\CssSelector\Node\HashNode

Represents a "<selector>#<id>" node.

This component is a port of the Python cssselect library, which is copyright Ian Bicking, @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>

Hierarchy

Expanded class hierarchy of HashNode

See also

https://github.com/SimonSapin/cssselect.

2 files declare their use of HashNode
HashNodeTest.php in vendor/symfony/css-selector/Tests/Node/HashNodeTest.php
HashParser.php in vendor/symfony/css-selector/Parser/Shortcut/HashParser.php

File

vendor/symfony/css-selector/Node/HashNode.php, line 22

Namespace

Symfony\Component\CssSelector\Node
View source
class HashNode extends AbstractNode {

  /**
   * @var NodeInterface
   */
  private $selector;

  /**
   * @var string
   */
  private $id;

  /**
   * @param NodeInterface $selector
   * @param string        $id
   */
  public function __construct(NodeInterface $selector, $id) {
    $this->selector = $selector;
    $this->id = $id;
  }

  /**
   * @return NodeInterface
   */
  public function getSelector() {
    return $this->selector;
  }

  /**
   * @return string
   */
  public function getId() {
    return $this->id;
  }

  /**
   * {@inheritdoc}
   */
  public function getSpecificity() {
    return $this->selector
      ->getSpecificity()
      ->plus(new Specificity(1, 0, 0));
  }

  /**
   * {@inheritdoc}
   */
  public function __toString() {
    return sprintf('%s[%s#%s]', $this
      ->getNodeName(), $this->selector, $this->id);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AbstractNode::$nodeName private property
AbstractNode::getNodeName public function Overrides NodeInterface::getNodeName
HashNode::$id private property
HashNode::$selector private property
HashNode::getId public function
HashNode::getSelector public function
HashNode::getSpecificity public function Returns node's specificity. Overrides NodeInterface::getSpecificity
HashNode::__construct public function
HashNode::__toString public function Returns node's string representation. Overrides NodeInterface::__toString