3 abstract class UserArray
implements Iterator
{
4 static function newFromResult( $res ) {
6 if ( !wfRunHooks( 'UserArrayFromResult', array( &$userArray, $res ) ) ) {
9 if ( $userArray === null ) {
10 $userArray = self
::newFromResult_internal( $res );
15 protected static function newFromResult_internal( $res ) {
16 $userArray = new UserArrayFromResult( $res );
21 class UserArrayFromResult
extends UserArray
{
25 function __construct( $res ) {
28 $this->setCurrent( $this->res
->current() );
31 protected function setCurrent( $row ) {
32 if ( $row === false ) {
33 $this->current
= false;
35 $this->current
= User
::newFromRow( $row );
39 public function count() {
40 return $this->res
->numRows();
44 return $this->current
;
52 $row = $this->res
->next();
53 $this->setCurrent( $row );
60 $this->setCurrent( $this->res
->current() );
64 return $this->current
!== false;