public function QueryPath::firstChild in QueryPath 6
Same name and namespace in other branches
- 7.3 QueryPath/QueryPath.php \QueryPath::firstChild()
- 7.2 QueryPath/QueryPath.php \QueryPath::firstChild()
File
- QueryPath/
QueryPath.php, line 1692
Class
Code
public function firstChild() {
$found = new SplObjectStorage();
$flag = false;
foreach ($this->matches as $m) {
foreach ($m->childNodes as $c) {
if ($c->nodeType == XML_ELEMENT_NODE) {
$found
->attach($c);
$flag = true;
break;
}
}
if ($flag) {
break;
}
}
$this
->setMatches($found);
$this->matches = $found;
return $this;
}