*/
abstract class TitleArray implements Iterator {
/**
- * @param $res result A MySQL result including at least page_namespace and
+ * @param $res ResultWrapper A SQL result including at least page_namespace and
* page_title -- also can have page_id, page_len, page_is_redirect,
* page_latest (if those will be used). See Title::newFromRow.
- * @return TitleArray
+ * @return TitleArrayFromResult
*/
static function newFromResult( $res ) {
$array = null;
return $array;
}
+ /**
+ * @param $res ResultWrapper
+ * @return TitleArrayFromResult
+ */
protected static function newFromResult_internal( $res ) {
$array = new TitleArrayFromResult( $res );
return $array;
}
class TitleArrayFromResult extends TitleArray {
+
+ /**
+ * @var ResultWrapper
+ */
var $res;
var $key, $current;
$this->setCurrent( $this->res->current() );
}
+ /**
+ * @param $row ResultWrapper
+ * @return void
+ */
protected function setCurrent( $row ) {
if ( $row === false ) {
$this->current = false;
}
}
+ /**
+ * @return int
+ */
public function count() {
return $this->res->numRows();
}
$this->setCurrent( $this->res->current() );
}
+ /**
+ * @return bool
+ */
function valid() {
return $this->current !== false;
}