You are here

public function QueryPath::odd in QueryPath 6

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

File

QueryPath/QueryPath.php, line 1665

Class

QueryPath

Code

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