You are here

public function QueryPath::filterLambda in QueryPath 6

Same name and namespace in other branches
  1. 7.3 QueryPath/QueryPath.php \QueryPath::filterLambda()
  2. 7.2 QueryPath/QueryPath.php \QueryPath::filterLambda()

File

QueryPath/QueryPath.php, line 476

Class

QueryPath

Code

public function filterLambda($fn) {
  $function = create_function('$index, $item', $fn);
  $found = new SplObjectStorage();
  $i = 0;
  foreach ($this->matches as $item) {
    if ($function($i++, $item) !== FALSE) {
      $found
        ->attach($item);
    }
  }
  $this
    ->setMatches($found);
  return $this;
}