r83543 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83542‎ | r83543 | r83544 >
Date:20:17, 8 March 2011
Author:reedy
Status:ok
Tags:
Comment:
More documentation and class definitions

Few tweaks to braces
Modified paths:
  • /trunk/phase3/includes/Category.php (modified) (history)
  • /trunk/phase3/includes/CategoryPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/CategoryPage.php
@@ -82,15 +82,48 @@
8383 }
8484
8585 class CategoryViewer {
86 - var $title, $limit, $from, $until,
 86+ var $limit, $from, $until,
8787 $articles, $articles_start_char,
8888 $children, $children_start_char,
89 - $showGallery, $gallery,
90 - $imgsNoGalley, $imgsNoGallery_start_char,
91 - $skin, $collation;
92 - # Category object for this page
 89+ $showGallery, $imgsNoGalley,
 90+ $imgsNoGallery_start_char,
 91+ $skin, $imgsNoGallery;
 92+
 93+ /**
 94+ * @var
 95+ */
 96+ var $nextPage;
 97+
 98+ /**
 99+ * @var Array
 100+ */
 101+ var $flip;
 102+
 103+ /**
 104+ * @var Title
 105+ */
 106+ var $title;
 107+
 108+ /**
 109+ * @var Collation
 110+ */
 111+ var $collation;
 112+
 113+ /**
 114+ * @var ImageGallery
 115+ */
 116+ var $gallery;
 117+
 118+ /**
 119+ * Category object for this page
 120+ * @var Category
 121+ */
93122 private $cat;
94 - # The original query array, to be used in generating paging links.
 123+
 124+ /**
 125+ * The original query array, to be used in generating paging links.
 126+ * @var array
 127+ */
95128 private $query;
96129
97130 function __construct( $title, $from = '', $until = '', $query = array() ) {
@@ -160,6 +193,9 @@
161194 }
162195 }
163196
 197+ /**
 198+ * @return Skin
 199+ */
164200 function getSkin() {
165201 if ( !$this->skin ) {
166202 global $wgUser;
@@ -202,6 +238,9 @@
203239 * entry in the categorylinks table is Category:A, not A, which it SHOULD be.
204240 * Workaround: If sortkey == "Category:".$title, than use $title for sorting,
205241 * else use sortkey...
 242+ *
 243+ * @param Title $title
 244+ * @param string $sortkey
206245 */
207246 function getSubcategorySortChar( $title, $sortkey ) {
208247 global $wgContLang;
@@ -528,10 +567,8 @@
529568 static function shortList( $articles, $articles_start_char ) {
530569 $r = '<h3>' . htmlspecialchars( $articles_start_char[0] ) . "</h3>\n";
531570 $r .= '<ul><li>' . $articles[0] . '</li>';
532 - for ( $index = 1; $index < count( $articles ); $index++ )
533 - {
534 - if ( $articles_start_char[$index] != $articles_start_char[$index - 1] )
535 - {
 571+ for ( $index = 1; $index < count( $articles ); $index++ ) {
 572+ if ( $articles_start_char[$index] != $articles_start_char[$index - 1] ) {
536573 $r .= "</ul><h3>" . htmlspecialchars( $articles_start_char[$index] ) . "</h3>\n<ul>";
537574 }
538575
@@ -629,8 +666,7 @@
630667 }
631668
632669 if ( $dbcnt == $rescnt || ( ( $rescnt == $this->limit || $fromOrUntil )
633 - && $dbcnt > $rescnt ) )
634 - {
 670+ && $dbcnt > $rescnt ) ) {
635671 # Case 1: seems sane.
636672 $totalcnt = $dbcnt;
637673 } elseif ( $rescnt < $this->limit && !$fromOrUntil ) {
Index: trunk/phase3/includes/Category.php
@@ -13,7 +13,10 @@
1414 /** Name of the category, normalized to DB-key form */
1515 private $mName = null;
1616 private $mID = null;
17 - /** Category page title */
 17+ /**
 18+ * Category page title
 19+ * @var Title
 20+ */
1821 private $mTitle = null;
1922 /** Counts of membership (cat_pages, cat_subcats, cat_files) */
2023 private $mPages = null, $mSubcats = null, $mFiles = null;
@@ -100,7 +103,7 @@
101104 * Factory function.
102105 *
103106 * @param $title Title for the category page
104 - * @return Mixed: category, or false on a totally invalid name
 107+ * @return category|false on a totally invalid name
105108 */
106109 public static function newFromTitle( $title ) {
107110 $cat = new self();
@@ -129,7 +132,7 @@
130133 * @param $row result set row, must contain the cat_xxx fields. If the fields are null,
131134 * the resulting Category object will represent an empty category if a title object
132135 * was given. If the fields are null and no title was given, this method fails and returns false.
133 - * @param $title optional title object for the category represented by the given row.
 136+ * @param Title $title optional title object for the category represented by the given row.
134137 * May be provided if it is already known, to avoid having to re-create a title object later.
135138 * @return Category
136139 */
@@ -182,7 +185,7 @@
183186 public function getFileCount() { return $this->getX( 'mFiles' ); }
184187
185188 /**
186 - * @return mixed The Title for this category, or false on failure.
 189+ * @return Title|false Title for this category, or false on failure.
187190 */
188191 public function getTitle() {
189192 if ( $this->mTitle ) return $this->mTitle;

Status & tagging log