You are here

class ElementNode in Zircon Profile 8.0

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

Represents a "<namespace>|<element>" 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 ElementNode

See also

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

13 files declare their use of ElementNode
AttributeNodeTest.php in vendor/symfony/css-selector/Tests/Node/AttributeNodeTest.php
ClassNodeTest.php in vendor/symfony/css-selector/Tests/Node/ClassNodeTest.php
ClassParser.php in vendor/symfony/css-selector/Parser/Shortcut/ClassParser.php
CombinedSelectorNodeTest.php in vendor/symfony/css-selector/Tests/Node/CombinedSelectorNodeTest.php
ElementNodeTest.php in vendor/symfony/css-selector/Tests/Node/ElementNodeTest.php

... See full list

File

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

Namespace

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

  /**
   * @var string|null
   */
  private $namespace;

  /**
   * @var string|null
   */
  private $element;

  /**
   * @param string|null $namespace
   * @param string|null $element
   */
  public function __construct($namespace = null, $element = null) {
    $this->namespace = $namespace;
    $this->element = $element;
  }

  /**
   * @return null|string
   */
  public function getNamespace() {
    return $this->namespace;
  }

  /**
   * @return null|string
   */
  public function getElement() {
    return $this->element;
  }

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

  /**
   * {@inheritdoc}
   */
  public function __toString() {
    $element = $this->element ?: '*';
    return sprintf('%s[%s]', $this
      ->getNodeName(), $this->namespace ? $this->namespace . '|' . $element : $element);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AbstractNode::$nodeName private property
AbstractNode::getNodeName public function Overrides NodeInterface::getNodeName
ElementNode::$element private property
ElementNode::$namespace private property
ElementNode::getElement public function
ElementNode::getNamespace public function
ElementNode::getSpecificity public function Returns node's specificity. Overrides NodeInterface::getSpecificity
ElementNode::__construct public function
ElementNode::__toString public function Returns node's string representation. Overrides NodeInterface::__toString