You are here

public function QueryPath::even in QueryPath 6

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

File

QueryPath/QueryPath.php, line 1652

Class

QueryPath

Code

public function even() {
  $found = new SplObjectStorage();
  $even = false;
  foreach ($this->matches as $m) {
    if ($even && $m->nodeType == XML_ELEMENT_NODE) {
      $found
        ->attach($m);
    }
    $even = $even ? false : true;
  }
  $this
    ->setMatches($found);
  $this->matches = $found;
  return $this;
}