Symfony\Component\CssSelector\XPathExpr::join PHP Method

join() public method

public join ( $combiner, $other )
    public function join($combiner, $other)
    {
        $prefix = (string) $this;
        $prefix .= $combiner;
        $path = $other->getPrefix() . $other->getPath();
        /* We don't need a star prefix if we are joining to this other
           prefix; so we'll get rid of it */
        if ($other->hasStarPrefix() && $path == '*/') {
            $path = '';
        }
        $this->prefix = $prefix;
        $this->path = $path;
        $this->element = $other->getElement();
        $this->condition = $other->GetCondition();
    }

Usage Example

 /**
  * 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;
 }