X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FUserArray.php;h=c5ba0b2b350fa8c90643d5ca924c062509a0fead;hb=fd03a2922af901d5c12e1039aed84647efd757f6;hp=a2f54b7f2753fb2e155b58b732b0a2059977f143;hpb=7452677213a14ef046144a03da2d017c696b950b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/UserArray.php b/includes/UserArray.php index a2f54b7f27..c5ba0b2b35 100644 --- a/includes/UserArray.php +++ b/includes/UserArray.php @@ -1,6 +1,10 @@ select( 'user', '*', array( 'user_id' => $ids ), + __METHOD__ ); + return self::newFromResult( $res ); + } + + /** + * @param $res + * @return UserArrayFromResult + */ protected static function newFromResult_internal( $res ) { - $userArray = new UserArrayFromResult( $res ); - return $userArray; + return new UserArrayFromResult( $res ); } } class UserArrayFromResult extends UserArray { + + /** + * @var ResultWrapper + */ var $res; var $key, $current; + /** + * @param $res ResultWrapper + */ function __construct( $res ) { $this->res = $res; $this->key = 0; $this->setCurrent( $this->res->current() ); } + /** + * @param $row + * @return void + */ protected function setCurrent( $row ) { if ( $row === false ) { $this->current = false; @@ -36,10 +70,16 @@ class UserArrayFromResult extends UserArray { } } + /** + * @return int + */ public function count() { return $this->res->numRows(); } + /** + * @return User + */ function current() { return $this->current; } @@ -60,6 +100,9 @@ class UserArrayFromResult extends UserArray { $this->setCurrent( $this->res->current() ); } + /** + * @return bool + */ function valid() { return $this->current !== false; }