You are here

class ClassNode in Zircon Profile 8.0

Same name in this branch
  1. 8.0 vendor/symfony/css-selector/Node/ClassNode.php \Symfony\Component\CssSelector\Node\ClassNode
  2. 8.0 vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/ClassNode.php \Prophecy\Doubler\Generator\Node\ClassNode
Same name and namespace in other branches
  1. 8 vendor/symfony/css-selector/Node/ClassNode.php \Symfony\Component\CssSelector\Node\ClassNode

Represents a "<selector>.<name>" 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 ClassNode

See also

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

3 files declare their use of ClassNode
ClassNodeTest.php in vendor/symfony/css-selector/Tests/Node/ClassNodeTest.php
ClassParser.php in vendor/symfony/css-selector/Parser/Shortcut/ClassParser.php
NegationNodeTest.php in vendor/symfony/css-selector/Tests/Node/NegationNodeTest.php

File

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

Namespace

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

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

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

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

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

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

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

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

}

Members

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