res = $res; $this->key = 0; $this->setCurrent( $this->res->current() ); } /** * @param bool|ResultWrapper $row * @return void */ protected function setCurrent( $row ) { if ( $row === false ) { $this->current = false; } else { $this->current = Title::newFromRow( $row ); } } /** * @return int */ public function count() { return $this->res->numRows(); } function current() { return $this->current; } function key() { return $this->key; } function next() { $row = $this->res->next(); $this->setCurrent( $row ); $this->key++; } function rewind() { $this->res->rewind(); $this->key = 0; $this->setCurrent( $this->res->current() ); } /** * @return bool */ function valid() { return $this->current !== false; } }