public function QueryPath::each in QueryPath 6
Same name and namespace in other branches
- 7.3 QueryPath/QueryPath.php \QueryPath::each()
- 7.2 QueryPath/QueryPath.php \QueryPath::each()
File
- QueryPath/
QueryPath.php, line 609
Class
Code
public function each($callback) {
if (is_callable($callback)) {
$i = 0;
foreach ($this->matches as $item) {
if (call_user_func($callback, $i, $item) === FALSE) {
return $this;
}
++$i;
}
}
else {
throw new QueryPathException('Callback is not callable.');
}
return $this;
}