/** * Checks if current position is valid. * * @return bool Returns true on success, false otherwise */ public function valid() { if (is_null($this->current)) { return !empty($this->branch); } if ($this->current instanceof RecursiveLeafInterface) { return $this->current->valid(); } return false; }
/** * For a callable, it's always valid to iterate * * @return bool */ public function valid() { return $this->generator ? $this->generator->valid() : true; }