Beispiel #1
0
 /**
  * @param NodeInterface $node
  *
  * @return XPathExpr
  *
  * @throws ExpressionErrorException
  */
 public function nodeToXPath(NodeInterface $node)
 {
     if (!isset($this->nodeTranslators[$node->getNodeName()])) {
         throw new ExpressionErrorException(sprintf('Node "%s" not supported.', $node->getNodeName()));
     }
     return call_user_func($this->nodeTranslators[$node->getNodeName()], $node, $this);
 }
 /**
  * Joins an XPath expression as an indirect adjacent of another.
  *
  * @param XPathExpr     $xpath The parent XPath expression
  * @param NodeInterface $sub   The indirect adjacent NodeInterface object
  *
  * @return XPathExpr An XPath instance
  */
 protected function _xpath_indirect_adjacent($xpath, $sub)
 {
     // when sub comes somewhere after xpath as a sibling
     $xpath->join('/following-sibling::', $sub->toXpath());
     return $xpath;
 }
Beispiel #3
0
 /**
  * {@inheritdoc}
  */
 public function getSpecificity()
 {
     return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0));
 }
Beispiel #4
0
 /** @dataProvider getSpecificityValueTestData */
 public function testSpecificityValue(NodeInterface $node, $value)
 {
     $this->assertEquals($value, $node->getSpecificity()->getValue());
 }