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