const DIR_ASCENDING = false;
const DIR_DESCENDING = true;
+ /** @var WebRequest */
public $mRequest;
+ /** @var int[] List of default entry limit options to be presented to clients */
public $mLimitsShown = [ 20, 50, 100, 250, 500 ];
+ /** @var int The default entry limit choosen for clients */
public $mDefaultLimit = 50;
- public $mOffset, $mLimit;
+ /** @var mixed The starting point to enumerate entries */
+ public $mOffset;
+ /** @var int The maximum number of entries to show */
+ public $mLimit;
+ /** @var bool Whether the listing query completed */
public $mQueryDone = false;
/** @var IDatabase */
public $mDb;
+ /** @var stdClass|bool|null Extra row fetched at the end to see if the end was reached */
public $mPastTheEndRow;
/**
* The index to actually be used for ordering. This is a single column,
* for one ordering, even if multiple orderings are supported.
+ * @var string
*/
protected $mIndexField;
/**
* An array of secondary columns to order by. These fields are not part of the offset.
* This is a column list for one ordering, even if multiple orderings are supported.
+ * @var string[]
*/
protected $mExtraSortFields;
/** For pages that support multiple types of ordering, which one to use.
+ * @var string|null
*/
protected $mOrderType;
/**
* $mDefaultDirection gives the direction to use when sorting results:
- * DIR_ASCENDING or DIR_DESCENDING. If $mIsBackwards is set, we
- * start from the opposite end, but we still sort the page itself according
- * to $mDefaultDirection. E.g., if $mDefaultDirection is false but we're
- * going backwards, we'll display the last page of results, but the last
- * result will be at the bottom, not the top.
+ * DIR_ASCENDING or DIR_DESCENDING. If $mIsBackwards is set, we start from
+ * the opposite end, but we still sort the page itself according to
+ * $mDefaultDirection. For example, if $mDefaultDirection is DIR_ASCENDING
+ * but we're going backwards, we'll display the last page of results, but
+ * the last result will be at the bottom, not the top.
*
* Like $mIndexField, $mDefaultDirection will be a single value even if the
* class supports multiple default directions for different order types.
+ * @var bool
*/
public $mDefaultDirection;
+ /** @var bool */
public $mIsBackwards;
- /** True if the current result set is the first one */
+ /** @var bool True if the current result set is the first one */
public $mIsFirst;
+ /** @var bool */
public $mIsLast;
- protected $mLastShown, $mFirstShown, $mPastTheEndIndex, $mDefaultQuery, $mNavigationBar;
+ /** @var mixed */
+ protected $mLastShown;
+ /** @var mixed */
+ protected $mFirstShown;
+ /** @var mixed */
+ protected $mPastTheEndIndex;
+ /** @var array */
+ protected $mDefaultQuery;
+ /** @var string */
+ protected $mNavigationBar;
/**
* Whether to include the offset in the query
+ * @var bool
*/
protected $mIncludeOffset = false;
$fname = __METHOD__ . ' (' . static::class . ')';
$section = Profiler::instance()->scopedProfileIn( $fname );
- // @todo This should probably compare to DIR_DESCENDING and DIR_ASCENDING constants
- $descending = ( $this->mIsBackwards == $this->mDefaultDirection );
+ $descending = $this->mIsBackwards
+ ? ( $this->mDefaultDirection === self::DIR_DESCENDING )
+ : ( $this->mDefaultDirection === self::DIR_ASCENDING );
+
# Plus an extra row so that we can tell the "next" link should be shown
$queryLimit = $this->mLimit + 1;
* Needless to say, it's really not a good idea to use a non-unique index
* for this! That won't page right.
*
- * @return string|array
+ * @return string|string[]
*/
abstract function getIndexField();
* page_len,page_id avoids temp tables (given a page_len index). This would
* also work if page_id was non-unique but we had a page_len,page_id index.
*
- * @return array
+ * @return string[]|array[]
*/
protected function getExtraSortFields() {
return [];