buildXpath() public static method

public static buildXpath ( array $segments, string $prefix = '//' ) : string
$segments array
$prefix string Specifies the nesting of nodes
return string XPath expression
Example #1
0
 /**
  * @param string CSS selector
  * @param array
  *
  * @return NodeList
  */
 public function findByRule($selector, $rules, $wrapElement = true)
 {
     $segments = $selector !== null ? Query::getSegments($selector) : [];
     $xpath = Query::buildXpath(array_merge($segments, $rules));
     return $this->xpath($xpath, $wrapElement);
 }
Example #2
0
 /**
  * @expectedException InvalidArgumentException
  */
 public function testBuildXpathWithEmptyArray()
 {
     Query::buildXpath([]);
 }